Added truth checks to avoid unnecessarily firing initSelection.
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
This commit is contained in:
parent
d54fd4dd0e
commit
ad8fd257aa
@ -1448,7 +1448,7 @@
|
|||||||
this.updateSelection(data);
|
this.updateSelection(data);
|
||||||
} else {
|
} else {
|
||||||
// val is an object. !val is true for [undefined,null,'']
|
// val is an object. !val is true for [undefined,null,'']
|
||||||
if (this.opts.initSelection) {
|
if (this.opts.initSelection && val) {
|
||||||
that = this;
|
that = this;
|
||||||
this.opts.initSelection(this.opts.element.val(val), function(data){
|
this.opts.initSelection(this.opts.element.val(val), function(data){
|
||||||
self.opts.element.val(!data ? "" : self.id(data));
|
self.opts.element.val(!data ? "" : self.id(data));
|
||||||
@ -1915,7 +1915,7 @@
|
|||||||
});
|
});
|
||||||
this.updateSelection(data);
|
this.updateSelection(data);
|
||||||
} else {
|
} else {
|
||||||
if (this.opts.initSelection) {
|
if (this.opts.initSelection && val !== null) {
|
||||||
this.opts.initSelection(this.opts.element.val(val), function(newVal){
|
this.opts.initSelection(this.opts.element.val(val), function(newVal){
|
||||||
$(newVal).each(function () { data.push(self.id(this)); });
|
$(newVal).each(function () { data.push(self.id(this)); });
|
||||||
self.setVal(data);
|
self.setVal(data);
|
||||||
|
Loading…
Reference in New Issue
Block a user