var cb_openValve = new Ext.form.Checkbox({
id: "myCheckbox",
name: "myCheckbox",
fieldLabel: '复选框',
boxLabel: '未选',
checked: false,
listeners: {
click: {//点击事件
element: 'el',
fn: function (obj, o2, o3, o4, o5) {
var thisObj = Ext.getCmp(this.id);
var isCheck = thisObj.getValue();
if (isCheck) {
thisObj.setCheck();
}
else {
thisObj.setUnCheck();
}
}
}
},
setText: function (value, textStr) {//基础设置方法
var thisObj = Ext.getCmp(this.id);
thisObj.setValue(value);
thisObj.boxLabel = textStr;
thisObj.getEl().down('.x-form-cb-label').update(textStr);
},
setCheck: function () {//勾选
var thisObj = Ext.getCmp(this.id);
thisObj.setText(true, '选择');
},
setUnCheck: function () {//不勾选
var thisObj = Ext.getCmp(this.id);
thisObj.setText(false, '未选');
}
});
转载于:https://my.oschina.net/raddleoj/blog/351824