1
0
mirror of synced 2024-11-23 05:26:10 +03:00

fire selected before close. #835

This commit is contained in:
Igor Vaynberg 2013-02-09 19:13:21 -08:00
parent a4c76f2dfb
commit 6c9aef4bb3

View File

@ -1846,13 +1846,14 @@ the specific language governing permissions and limitations under the Apache Lic
this.opts.element.val(this.id(data)); this.opts.element.val(this.id(data));
this.updateSelection(data); this.updateSelection(data);
this.opts.element.trigger({ type: "selected", val: this.id(data), choice: data });
this.close(); this.close();
if (!options || !options.noFocus) if (!options || !options.noFocus)
this.selection.focus(); this.selection.focus();
this.opts.element.trigger({ type: "selected", val: this.id(data), choice: data });
if (!equal(old, this.id(data))) { this.triggerChange(); } if (!equal(old, this.id(data))) { this.triggerChange(); }
}, },
@ -2233,6 +2234,8 @@ the specific language governing permissions and limitations under the Apache Lic
onSelect: function (data, options) { onSelect: function (data, options) {
this.addSelectedChoice(data); this.addSelectedChoice(data);
this.opts.element.trigger({ type: "selected", val: this.id(data), choice: data });
if (this.select || !this.opts.closeOnSelect) this.postprocessResults(); if (this.select || !this.opts.closeOnSelect) this.postprocessResults();
if (this.opts.closeOnSelect) { if (this.opts.closeOnSelect) {
@ -2255,8 +2258,6 @@ the specific language governing permissions and limitations under the Apache Lic
} }
} }
this.opts.element.trigger({ type: "selected", val: this.id(data), choice: data });
// since its not possible to select an element that has already been // since its not possible to select an element that has already been
// added we do not need to check if this is a new element before firing change // added we do not need to check if this is a new element before firing change
this.triggerChange({ added: data }); this.triggerChange({ added: data });