Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
How do I get buttons to change state (enable) with WebGrid
posted

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 

Parents
No Data
Reply
  • 12025
    posted

    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.

     The following code snippet inside of your SelectedRowsChangeEvent listener should do the trick, make sure you use the correct 'client id' of the command button to make it work on your page. public void SelectedRowsChanged(SelectedRowsChangeEvent e)

    {

    //myButton is HtmlCommandButton that will be disabled

    myButton.setDisabled(true);

     

    // SmartRefreshManager is Infragistics AJAX manager on the server

    SmartRefreshManager srm = SmartRefreshManager.getCurrentInstance();

     

    //mainform:myButton is the client id of my button

    srm.addSmartRefreshId("mainForm:myButton");

    }

    Hope this helps,

    Taz.

Children