I want to enable or disable checkboxes in EXTJS
dockedItems: [{
xtype: toolbar ,
dock: top ,
items: [{
xtype: radiofield ,
id: all ,
name: show ,
boxLabel: All ,
checked: true,
inputValue: all
}, {
xtype: radiofield ,
id: online ,
name: show ,
boxLabel: Online ,
inputValue: online
}, {
xtype: radiofield ,
id: offline ,
name: show ,
boxLabel: Offline ,
inputValue: offline
}, {
xtype: checkboxfield ,
id: cb1 ,
boxLabel: Sometimes ,
checked: true,
inputValue: sometimes
}, {
xtype: checkboxfield ,
id: cb2 ,
boxLabel: Always ,
checked: true,
inputValue: always
}],
listeners: {
change: function (field, newValue, oldValue) {
var value = newValue.show;
if (value == all ) {
var cb1 = Ext.getCmp( cb1 );
var cb2 = Ext.getCmp( cb2 );
cb1.disable();
cb2.disable();
}
if (value == online ) {
var cb1 = Ext.getCmp( cb1 );
var cb2 = Ext.getCmp( cb2 );
cb1.disable();
cb2.disable();
}
if (value == offline ) {
var cb1 = Ext.getCmp( cb1 );
var cb2 = Ext.getCmp( cb2 );
cb1.enable();
cb2.enable();
}
}
}
}]
How can I enable these checkboxes? They should be enabled when the user selects the offline option and disabled when the user selects other option.
感谢你们的帮助!