1
0
mirror of synced 2025-02-19 21:43:15 +03:00

small fix for #1604

This commit is contained in:
Igor Vaynberg 2013-08-09 16:38:23 -07:00
parent 00ba1bddfa
commit 2400357d59

View File

@ -775,7 +775,7 @@ the specific language governing permissions and limitations under the Apache Lic
this.autofocus = opts.element.prop("autofocus"); this.autofocus = opts.element.prop("autofocus");
opts.element.prop("autofocus", false); opts.element.prop("autofocus", false);
if (this.autofocus) this.focus(); if (this.autofocus) this.focus();
this.nextSearchTerm = undefined; this.nextSearchTerm = undefined;
}, },
@ -1824,7 +1824,7 @@ the specific language governing permissions and limitations under the Apache Lic
len = this.search.val().length; len = this.search.val().length;
el.setSelectionRange(len, len); el.setSelectionRange(len, len);
} }
// initializes search's value with nextSearchTerm (if defined by user) // initializes search's value with nextSearchTerm (if defined by user)
// ignore nextSearchTerm if the dropdown is opened by the user pressing a letter // ignore nextSearchTerm if the dropdown is opened by the user pressing a letter
if(this.search.val() === "") { if(this.search.val() === "") {
@ -1833,7 +1833,7 @@ the specific language governing permissions and limitations under the Apache Lic
this.search.select(); this.search.select();
} }
} }
this.focusser.prop("disabled", true).val(""); this.focusser.prop("disabled", true).val("");
this.updateResults(true); this.updateResults(true);
this.opts.element.trigger($.Event("select2-open")); this.opts.element.trigger($.Event("select2-open"));
@ -2212,7 +2212,7 @@ the specific language governing permissions and limitations under the Apache Lic
this.opts.element.trigger({ type: "select2-selected", val: this.id(data), choice: data }); this.opts.element.trigger({ type: "select2-selected", val: this.id(data), choice: data });
this.nextSearchTerm=this.opts.nextSearchTerm(data, data.text); this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
this.close(); this.close();
if (!options || !options.noFocus) if (!options || !options.noFocus)