PDA

View Full Version : [CLOSED] Disable a toolbar button when no data in Grid panel



aditya
Mar 07, 2014, 12:02 PM
I would like to disable a button when there is no data in grid panel. What I would like to do is subscribe a event on GridPanel empty text. How can I achieve this?

Daniil
Mar 07, 2014, 12:22 PM
Hi @aditya,

Please listen to a Store's Load event and check the records' length. If it is zero, a GridPanel is going to be empty.

aditya
Mar 07, 2014, 1:35 PM
Hi @aditya,

Please listen to a Store's Load event and check the records' length. If it is zero, a GridPanel is going to be empty.

Achieved through Load listener of grid panel. Thanks.


<Listeners>
<Load Handler="CheckGridStore(records, #{btnActivateProject});" />
</Listeners>

function CheckGridStore(records, btnActivateButton)
{
alert(records.length);
if (records.length == 0) {
btnActivateButton.setDisabled(true);
}
else {
btnActivateButton.setDisabled(false);
}
}