0 Replies Latest reply on Feb 28, 2008 6:05 AM by Rafael Martony

    Datatable with checkboxes and

    Rafael Martony Newbie

      Hi everybody, I have a datatable with checkboxes in one colum and a datascroller.
      I want a checkbox that selects all checkboxes in the column.
      So I tried to code that with jQuery and I did the following:

      ...
      <rich:dataTable id="dataTable"
       var="item"
       value="#{principalHandler.rows}"
       binding="#{principalHandler.dataTable}"
       rows="10">
       <h:column>
       <f:facet name="header">
       <h:selectBooleanCheckbox id="selectAllItemsChbk" value="#{principalHandler.allRowsSelected}">
       </h:selectBooleanCheckbox>
       </f:facet>
       <h:selectBooleanCheckbox id="selectItemChbk" value="#{item.selected}"/>
       </h:column>
       <h:column>....</h:column>
      </rich:dataTable>
      
      <rich:jQuery id="selectAllScript" selector="input[id][name$=\'selectAllItemsChbk\']"
       query="click(function(){ var value = (jQuery(selector).attr('checked') == true ? 'checked' : ''); jQuery('input[id][name$=\'selectItemChbk\']').attr('checked', value); });"/>
      
      <rich:datascroller id="resultsScroller"
       for="dataTable"
       maxPages="9">
      </rich:datascroller>
      ...


      It works right in the first page but when I go to next page with datascroller, whenever I click it does nothing (no errors, nothing).
      What am I doing wrong?

      BTW, what's the best solution for this?

      Regards,
      Rafael.