1
0
mirror of synced 2025-03-10 22:56:12 +03:00

Merge branch 'master' of git://github.com/ivaynberg/select2

This commit is contained in:
Igor Vaynberg 2012-04-20 23:59:48 -07:00
commit 253703add3

View File

@ -419,6 +419,7 @@
select2.container.remove();
select2.opts.element
.removeData("select2")
.unbind(".select2")
.show();
}
},
@ -503,7 +504,7 @@
* Monitor the original element for changes and update select2 accordingly
*/
monitorSource: function () {
this.opts.element.bind("change", this.bind(function (e) {
this.opts.element.bind("change.select2", this.bind(function (e) {
if (this.opts.element.data("select2-change-triggered") !== true) {
this.initSelection();
}
@ -1026,8 +1027,8 @@
});
this.updateSelection(data);
} else {
// val is an object
this.opts.element.val((val === null || val === "") ? "" : val.id);
// val is an object. !val is true for [undefined,null,'']
this.opts.element.val(!val ? "" : val.id);
this.updateSelection(val);
}
this.setPlaceholder();
@ -1061,6 +1062,9 @@
prepareOpts: function () {
var opts = this.parent.prepareOpts.apply(this, arguments);
// TODO validate placeholder is a string if specified
if (opts.element.get(0).tagName.toLowerCase() === "select") {
// install sthe selection initializer
this.opts.initSelection = function (element) {