checkbox的setValue()方法源码是:
setValue : function(v) {
var checked = this.checked;
this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
if(this.el && this.el.dom){
this.el.dom.checked = this.checked;
this.el.dom.defaultChecked = this.checked;
}
this.wrap[this.checked? 'addClass' : 'removeClass'](this.checkedCls);
if(checked != this.checked){
this.fireEvent("check", this, this.checked);
if(this.handler){
this.handler.call(this.scope || this, this, this.checked);
}
}
}
是将值设置一下(true或false),样式改变一下,然后去执行 this.fireEvent("check", this, this.checked);check事件。
怎么才能将checkbox的值改变,样式也改变,但是不去执行事件呢?只有重写setvalue()方法?
setValue : function(v) {
var checked = this.checked;
this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
if(this.el && this.el.dom){
this.el.dom.checked = this.checked;
this.el.dom.defaultChecked = this.checked;
}
this.wrap[this.checked? 'addClass' : 'removeClass'](this.checkedCls);
if(checked != this.checked){
this.fireEvent("check", this, this.checked);
if(this.handler){
this.handler.call(this.scope || this, this, this.checked);
}
}
}
是将值设置一下(true或false),样式改变一下,然后去执行 this.fireEvent("check", this, this.checked);check事件。
怎么才能将checkbox的值改变,样式也改变,但是不去执行事件呢?只有重写setvalue()方法?