Merge branch 'master' of git://github.com/ivaynberg/select2
This commit is contained in:
commit
253703add3
10
select2.js
10
select2.js
@ -419,6 +419,7 @@
|
|||||||
select2.container.remove();
|
select2.container.remove();
|
||||||
select2.opts.element
|
select2.opts.element
|
||||||
.removeData("select2")
|
.removeData("select2")
|
||||||
|
.unbind(".select2")
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -503,7 +504,7 @@
|
|||||||
* Monitor the original element for changes and update select2 accordingly
|
* Monitor the original element for changes and update select2 accordingly
|
||||||
*/
|
*/
|
||||||
monitorSource: function () {
|
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) {
|
if (this.opts.element.data("select2-change-triggered") !== true) {
|
||||||
this.initSelection();
|
this.initSelection();
|
||||||
}
|
}
|
||||||
@ -1026,8 +1027,8 @@
|
|||||||
});
|
});
|
||||||
this.updateSelection(data);
|
this.updateSelection(data);
|
||||||
} else {
|
} else {
|
||||||
// val is an object
|
// val is an object. !val is true for [undefined,null,'']
|
||||||
this.opts.element.val((val === null || val === "") ? "" : val.id);
|
this.opts.element.val(!val ? "" : val.id);
|
||||||
this.updateSelection(val);
|
this.updateSelection(val);
|
||||||
}
|
}
|
||||||
this.setPlaceholder();
|
this.setPlaceholder();
|
||||||
@ -1061,6 +1062,9 @@
|
|||||||
prepareOpts: function () {
|
prepareOpts: function () {
|
||||||
var opts = this.parent.prepareOpts.apply(this, arguments);
|
var opts = this.parent.prepareOpts.apply(this, arguments);
|
||||||
|
|
||||||
|
|
||||||
|
// TODO validate placeholder is a string if specified
|
||||||
|
|
||||||
if (opts.element.get(0).tagName.toLowerCase() === "select") {
|
if (opts.element.get(0).tagName.toLowerCase() === "select") {
|
||||||
// install sthe selection initializer
|
// install sthe selection initializer
|
||||||
this.opts.initSelection = function (element) {
|
this.opts.initSelection = function (element) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user