Automatically create options on select
This commit is contained in:
parent
d411a0fa76
commit
07e82d6be8
12
dist/js/select2.amd.full.js
vendored
12
dist/js/select2.amd.full.js
vendored
@ -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
dist/js/select2.amd.js
vendored
12
dist/js/select2.amd.js
vendored
@ -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
dist/js/select2.full.js
vendored
12
dist/js/select2.full.js
vendored
@ -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;
|
||||
|
||||
|
2
dist/js/select2.full.min.js
vendored
2
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
12
dist/js/select2.js
vendored
12
dist/js/select2.js
vendored
@ -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;
|
||||
|
||||
|
2
dist/js/select2.min.js
vendored
2
dist/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
12
src/js/select2/data/array.js
vendored
12
src/js/select2/data/array.js
vendored
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user