Hello,
I am trying to enable command buttons when a selection is made in a webGrid using SelectedRowsChangeEvent listener. I am able to change the state of the button desired but I can not get JSF to repaint the page with its new enabled look to the button; the button is still disabled as far as the user is concerned since it can not be pressed. I wanted to only allow the command button to pressed when they have a selection from the weGrid's select row checkboxes since the button will take action against there choices.
Any help would be appreciated.
--laz
Hi Laz,
Since the SelectedRowsChangeEvent listener is fired during an AJAX call, you need to tell the smart refersh manager the control that you want to update on the server so that its changes are reflected on the client as well.
{
//myButton is HtmlCommandButton that will be disabled
// SmartRefreshManager is Infragistics AJAX manager on the server
SmartRefreshManager srm = SmartRefreshManager.getCurrentInstance();
//mainform:myButton is the client id of my button
}
Hope this helps,
Taz.
I have almost same issue except in my grid we have 100 rows on page and we have showSelectAll set to true.
1, If user select all, is that SelectedRowsChangeEvent fires 100 times or just one?
2, how can I implement SelectedRowsChanged() in this case? do we have any listener to handle select all?
3, can we use commandlink instead of commandbutton?
Thanks in advance
Since the selected rows change fires for each row that is selected/unselected, clicking on showSelectAll will casues the selection listener to fire for each row in the grid. In order to enable or disable the button you can check for the size of the selected rows collection and then either enable or disable the button. You can certainly use command link instead of a button.
Hope this helps.