I have combobox and button on a form. And I want if the combobox is empty then the button is disabled but if combobox have records button is enabled.
{
xtype: 'combobox',
name : 'book',
fieldLabel: 'BookName',
value: name
}
buttons : [
{
text: 'Add',
action: 'Add_book'
}
]
You can add a listener to your combobox, you can change the function of the listener like you want
{
xtype: 'combobox',
name : 'book',
fieldLabel: 'BookName',
value: name,
listeners: {
afterrender: function() {
if (this.getValue() === null) {
Ext.getCmp('yourButton').setDisabled(true);
}
else {
Ext.getCmp('yourButton').setDisabled(false);
}
}
}
}