Added insertTag to control the tag position
This adds an option called `insertTag` that controls the location within the results where the tag is inserted. The function should take in the results array and the tag, and should modify the array in-place to add the tag to the results. This closes https://github.com/select2/select2/issues/3420 This closes https://github.com/select2/select2/pull/4008
This commit is contained in:
parent
63d531a9c0
commit
e842797aaf
6
src/js/select2/data/tags.js
vendored
6
src/js/select2/data/tags.js
vendored
@ -10,6 +10,12 @@ define([
|
|||||||
this.createTag = createTag;
|
this.createTag = createTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var insertTag = options.get('insertTag');
|
||||||
|
|
||||||
|
if (insertTag !== undefined) {
|
||||||
|
this.insertTag = insertTag;
|
||||||
|
}
|
||||||
|
|
||||||
decorated.call(this, $element, options);
|
decorated.call(this, $element, options);
|
||||||
|
|
||||||
if ($.isArray(tags)) {
|
if ($.isArray(tags)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user