Excludes create options with duplicate tag
This commit is contained in:
parent
53db0130d1
commit
b889a8d107
5
dist/js/select2.full.js
vendored
5
dist/js/select2.full.js
vendored
@ -3725,10 +3725,15 @@ S2.define('select2/data/tags',[
|
|||||||
var tag = self.createTag(params);
|
var tag = self.createTag(params);
|
||||||
|
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
|
// excludes create options with duplicate tag
|
||||||
|
if (
|
||||||
|
self.$element.find('option[value = "' + tag.id + '"]').length === 0
|
||||||
|
) {
|
||||||
var $option = self.option(tag);
|
var $option = self.option(tag);
|
||||||
$option.attr('data-select2-tag', true);
|
$option.attr('data-select2-tag', true);
|
||||||
|
|
||||||
self.addOptions([$option]);
|
self.addOptions([$option]);
|
||||||
|
}
|
||||||
|
|
||||||
self.insertTag(data, tag);
|
self.insertTag(data, tag);
|
||||||
}
|
}
|
||||||
|
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
5
dist/js/select2.js
vendored
5
dist/js/select2.js
vendored
@ -3725,10 +3725,15 @@ S2.define('select2/data/tags',[
|
|||||||
var tag = self.createTag(params);
|
var tag = self.createTag(params);
|
||||||
|
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
|
// excludes create options with duplicate tag
|
||||||
|
if (
|
||||||
|
self.$element.find('option[value = "' + tag.id + '"]').length === 0
|
||||||
|
) {
|
||||||
var $option = self.option(tag);
|
var $option = self.option(tag);
|
||||||
$option.attr('data-select2-tag', true);
|
$option.attr('data-select2-tag', true);
|
||||||
|
|
||||||
self.addOptions([$option]);
|
self.addOptions([$option]);
|
||||||
|
}
|
||||||
|
|
||||||
self.insertTag(data, tag);
|
self.insertTag(data, tag);
|
||||||
}
|
}
|
||||||
|
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
5
src/js/select2/data/tags.js
vendored
5
src/js/select2/data/tags.js
vendored
@ -79,10 +79,15 @@ define([
|
|||||||
var tag = self.createTag(params);
|
var tag = self.createTag(params);
|
||||||
|
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
|
// excludes create options with duplicate tag
|
||||||
|
if (
|
||||||
|
self.$element.find('option[value = "' + tag.id + '"]').length === 0
|
||||||
|
) {
|
||||||
var $option = self.option(tag);
|
var $option = self.option(tag);
|
||||||
$option.attr('data-select2-tag', true);
|
$option.attr('data-select2-tag', true);
|
||||||
|
|
||||||
self.addOptions([$option]);
|
self.addOptions([$option]);
|
||||||
|
}
|
||||||
|
|
||||||
self.insertTag(data, tag);
|
self.insertTag(data, tag);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user