2 Replies Latest reply on Jun 21, 2007 4:38 AM by paul kerrison

    Datatable onRowClick firing server side sction controller -

    paul kerrison Newbie


      Has anyone had any success at firing a server side action controller method from an onRowClick event in a datatable?

      The idea is that once a user clicks on a row they are taken to a detail page where they can edit the object that the row represents.

      I can do this by forcing the user to click on a commandButton or commandLink...but I'd rather let them just click on a row (the business demands it).

      My only workaround at the moment is quite messy in that it has a hidden submit button on every row - and when the user clicks on the row, a javascript function causes the button to submit (the action / actionlistener attribute dictates the server side method to call)

      I'm trying to put together a presentation to justify and teach the benefits of richFaces and unfortunately this solution is too messy to include...

      Does anyone have any better solutions?

      Thanks in advance for any help :-)



        • 2. Re: Datatable onRowClick firing server side sction controlle
          paul kerrison Newbie

          Thanks for your response - I did do some searches but did was obviously searchng for the wrong words :-)

          Either way I took a little bit from several of the responses and managed to fire my action controller:

          My Data Table

           onRowMouseOver="switchElmtClass(this, 'highlightRow', 'normalRow')"
           onRowMouseOut="switchElmtClass(this, 'highlightRow', 'normalRow')"
           summary="Provides a list of widgets available"
           <a4j:support event="onRowClick" action="#{widgetSummaryManager.selectWidget}"

          My widgetSummaryManager.selectWidget Action controller

          public String selectWidget() {
           logger.info("trying to get small widget dto");
           SmallWidgetDTO smallWidgetDTO = (SmallWidgetDTO) widgetDataModel.getRowData();
           logger.info("Attempting to get widget using id of "+ smallWidgetDTO.getId());
           WidgetDTO widgetDTO = getSearchMgr().getWidget(smallWidgetDTO.getId());
           return "widgetDetail";

          and the navigation rule in faces-config.xml that directs me to the next page...


          Thanks again for your help pointing me in the right direction and apologies for not managing to find it myself :-)