فهرست منبع

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;
 

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است