Skip to content

Commit d5cb4bf

Browse files
committed
Merge pull request select2#2044 from sieppl/master
singleSelect: setting nextSearchTerm in initSelection
2 parents 7087c4b + 48d3926 commit d5cb4bf

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

select2.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ the specific language governing permissions and limitations under the Apache Lic
762762
// dom it will trigger the popup close, which is not what we want
763763
this.dropdown.on("click mouseup mousedown", function (e) { e.stopPropagation(); });
764764

765+
this.nextSearchTerm = undefined;
766+
765767
if ($.isFunction(this.opts.initSelection)) {
766768
// initialize selection based on the current value of the source element
767769
this.initSelection();
@@ -789,8 +791,7 @@ the specific language governing permissions and limitations under the Apache Lic
789791
this.autofocus = opts.element.prop("autofocus");
790792
opts.element.prop("autofocus", false);
791793
if (this.autofocus) this.focus();
792-
793-
this.nextSearchTerm = undefined;
794+
794795
},
795796

796797
// abstract
@@ -2144,9 +2145,10 @@ the specific language governing permissions and limitations under the Apache Lic
21442145
self.updateSelection(selected);
21452146
self.close();
21462147
self.setPlaceholder();
2148+
self.nextSearchTerm = self.opts.nextSearchTerm(selected, self.search.val());
21472149
}
21482150
});
2149-
}
2151+
}
21502152
},
21512153

21522154
isPlaceholderOptionSelected: function() {

0 commit comments

Comments
 (0)