Skip to content

Commit e842797

Browse files
stretch4x4kevin-brown
authored andcommitted
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 select2#3420 This closes select2#4008
1 parent 63d531a commit e842797

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/js/select2/data/tags.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ define([
1010
this.createTag = createTag;
1111
}
1212

13+
var insertTag = options.get('insertTag');
14+
15+
if (insertTag !== undefined) {
16+
this.insertTag = insertTag;
17+
}
18+
1319
decorated.call(this, $element, options);
1420

1521
if ($.isArray(tags)) {

0 commit comments

Comments
 (0)