only validate initSelection is present on val() if we are not clearing
This commit is contained in:
parent
9a3666edb5
commit
cb7b5464a1
@ -2182,14 +2182,14 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
this.triggerChange({added: data, removed:oldData});
|
this.triggerChange({added: data, removed:oldData});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.opts.initSelection === undefined) {
|
|
||||||
throw new Error("cannot call val() if initSelection() is not defined");
|
|
||||||
}
|
|
||||||
// val is an id. !val is true for [undefined,null,'',0] - 0 is legal
|
// val is an id. !val is true for [undefined,null,'',0] - 0 is legal
|
||||||
if (!val && val !== 0) {
|
if (!val && val !== 0) {
|
||||||
this.clear(triggerChange);
|
this.clear(triggerChange);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.opts.initSelection === undefined) {
|
||||||
|
throw new Error("cannot call val() if initSelection() is not defined");
|
||||||
|
}
|
||||||
this.opts.element.val(val);
|
this.opts.element.val(val);
|
||||||
this.opts.initSelection(this.opts.element, function(data){
|
this.opts.initSelection(this.opts.element, function(data){
|
||||||
self.opts.element.val(!data ? "" : self.id(data));
|
self.opts.element.val(!data ? "" : self.id(data));
|
||||||
|
Loading…
Reference in New Issue
Block a user