0 Replies Latest reply on Jun 10, 2011 9:48 AM by Jethro Borsje

    rich:dataTable and checkbox with onRowClick

    Jethro Borsje Newbie

      Hi all,

       

      I am using a rich:datatable which contains a column with checkboxes (one checkbox for each row). I have also defined an a4j:support for the onRowClick event. Saddly these two don't play nice together . When I click on my checkbox I briefly see the selected checkbox after which the onRowClick is executed which navigates away from the page with the rich:datatable to a page showing the details of the selected row. What I would like to happen is that the checkbox gets selected. Bellow you'll find my code:

       

      <rich:dataTable id="list" value="#{myBean.model}" var="row" rows="#{myBean.visibleRows}"
                      onRowMouseOver="this.style.backgroundColor='#E5E5E5';" onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
      
                      <a4j:support action="#{myBean.onDetails}" event="onRowClick" reRender="content">
                          <a4j:actionparam name="id" value="#{row.id}" />
                      </a4j:support>
      
                      <rich:column align="center" width="10px">
                          <h:selectBooleanCheckbox id="checkEntry" value="#{myBean.selected[row.id]}">
                              <a4j:support event="onclick" oncomplete="event.stopPropagation(); Event.stop(event);" ajaxSingle="true" />
                          </h:selectBooleanCheckbox>
                      </rich:column>
      </rich:dataTable
      

       

      Can somebody explain to me how the desired behaviour can be achieved?

       

      Best regards,

      Jethro