소스 검색

Automatically create options on select

Kevin Brown 10 년 전
부모
커밋
07e82d6be8
7개의 변경된 파일60개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      dist/js/select2.amd.full.js
  2. 12 0
      dist/js/select2.amd.js
  3. 12 0
      dist/js/select2.full.js
  4. 0 0
      dist/js/select2.full.min.js
  5. 12 0
      dist/js/select2.js
  6. 0 0
      dist/js/select2.min.js
  7. 12 0
      src/js/select2/data/array.js

+ 12 - 0
dist/js/select2.amd.full.js

@@ -1212,6 +1212,18 @@ define('select2/data/array',[
 
   Utils.Extend(ArrayAdapter, SelectAdapter);
 
+  ArrayAdapter.prototype.select = function (data) {
+    var $option = this.$element.find('option[value="' + data.id + '"]');
+
+    if ($option.length === 0) {
+      $option = this.option(data);
+
+      this.$element.append($option);
+    }
+
+    ArrayAdapter.__super__.select.call(this, data);
+  };
+
   ArrayAdapter.prototype.convertToOptions = function (data) {
     var self = this;
 

+ 12 - 0
dist/js/select2.amd.js

@@ -1212,6 +1212,18 @@ define('select2/data/array',[
 
   Utils.Extend(ArrayAdapter, SelectAdapter);
 
+  ArrayAdapter.prototype.select = function (data) {
+    var $option = this.$element.find('option[value="' + data.id + '"]');
+
+    if ($option.length === 0) {
+      $option = this.option(data);
+
+      this.$element.append($option);
+    }
+
+    ArrayAdapter.__super__.select.call(this, data);
+  };
+
   ArrayAdapter.prototype.convertToOptions = function (data) {
     var self = this;
 

+ 12 - 0
dist/js/select2.full.js

@@ -10747,6 +10747,18 @@ define('select2/data/array',[
 
   Utils.Extend(ArrayAdapter, SelectAdapter);
 
+  ArrayAdapter.prototype.select = function (data) {
+    var $option = this.$element.find('option[value="' + data.id + '"]');
+
+    if ($option.length === 0) {
+      $option = this.option(data);
+
+      this.$element.append($option);
+    }
+
+    ArrayAdapter.__super__.select.call(this, data);
+  };
+
   ArrayAdapter.prototype.convertToOptions = function (data) {
     var self = this;
 

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/js/select2.full.min.js


+ 12 - 0
dist/js/select2.js

@@ -1640,6 +1640,18 @@ define('select2/data/array',[
 
   Utils.Extend(ArrayAdapter, SelectAdapter);
 
+  ArrayAdapter.prototype.select = function (data) {
+    var $option = this.$element.find('option[value="' + data.id + '"]');
+
+    if ($option.length === 0) {
+      $option = this.option(data);
+
+      this.$element.append($option);
+    }
+
+    ArrayAdapter.__super__.select.call(this, data);
+  };
+
   ArrayAdapter.prototype.convertToOptions = function (data) {
     var self = this;
 

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/js/select2.min.js


+ 12 - 0
src/js/select2/data/array.js

@@ -13,6 +13,18 @@ define([
 
   Utils.Extend(ArrayAdapter, SelectAdapter);
 
+  ArrayAdapter.prototype.select = function (data) {
+    var $option = this.$element.find('option[value="' + data.id + '"]');
+
+    if ($option.length === 0) {
+      $option = this.option(data);
+
+      this.$element.append($option);
+    }
+
+    ArrayAdapter.__super__.select.call(this, data);
+  };
+
   ArrayAdapter.prototype.convertToOptions = function (data) {
     var self = this;
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.