PDA

View Full Version : Enable/Disable buttons if datagrid item selected



iamcootis
29 May 2013, 9:42 AM
What I'm trying to do is enable/disable a set of buttons depending on whether something in my datagrid is selected.

Currently I have a listener listening for the 'select' event on my datagrid, which calls a function and sets my curSelectedDemo varaiable.

I'm coming from Flex, so binding this all together used to be very simple. What is the easiest way to make this happen?

DNRDustin
29 May 2013, 9:26 PM
create a controller, find the component, then disable on the fired event.

Malro
29 May 2013, 10:58 PM
hi, i just paste a short code example. you can add a listener to your selectionModell and enable/disable some buttons. (you have to set button1 and button2 ...)

...
selModel: {
xtype: 'rowmodel',
listeners: {
selectionchange: function(sm, selections) {
button1.setDisabled(selections.length === 0);
button2.setDisabled(selections.length === 0);
}
}
}
...