ignore replies that come in after select2 has been closed. fixes #299
This commit is contained in:
parent
afd353788b
commit
e4fbf91915
@ -1129,6 +1129,10 @@
|
||||
matcher: this.opts.matcher,
|
||||
callback: this.bind(function (data) {
|
||||
|
||||
// ignore a response if the select2 has been closed before it was received
|
||||
if (!self.opened()) return;
|
||||
|
||||
|
||||
self.opts.populateResults.call(this, results, data.results, {term: term, page: page, context:context});
|
||||
|
||||
if (data.more===true) {
|
||||
@ -1206,6 +1210,9 @@
|
||||
callback: this.bind(function (data) {
|
||||
var def; // default choice
|
||||
|
||||
// ignore a response if the select2 has been closed before it was received
|
||||
if (!this.opened()) return;
|
||||
|
||||
// save context, if any
|
||||
this.context = (data.context===undefined) ? null : data.context;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user