Ext.override(Ext.form.CheckboxGroup, {
getValue: function () {
var v = [];
for (var i = 0; i < this.items.length; i++) {
if (this.items.get(i).checked) {
v.push(this.items.get(i).inputValue);
}
}
return v.toString();
},
setValue: function (vals) {
var a = [];
if (Ext.isArray(vals)) {
a = vals;
}
else {
a = vals.split(',');
}
for (var i = 0; i < this.items.length; i++) {
this.items.get(i).setValue(false);
for (var j = 0; j < a.length; j++) {
var val = a[j];
if (val == this.items.get(i).inputValue) {
this.items.get(i).setValue(true);
}
}
}
}
});
//Ext.getCmp('cb_custwidth_id').setValue('1,2,3,4');
//Ext.getCmp('cb_custwidth_id').getValue();
extjs4中的checkboxgroup 重写
最新推荐文章于 2021-08-14 17:56:07 发布