1
0
mirror of synced 2024-11-29 16:16:02 +03:00

ignore replies that come in after select2 has been closed. fixes #299

This commit is contained in:
Igor Vaynberg 2012-08-16 23:04:29 -07:00
parent afd353788b
commit e4fbf91915

View File

@ -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;