4 Replies Latest reply on Jun 23, 2009 11:16 AM by ilya_shaikovsky

    weird behaviour of rich:dataTable

      Iam facing a weird problem when I use rich:dataTable, the same scenario works fine for h:dataTable. The situation is :

      I have a rich data table , and one of the columns in the datatable is a <h:selectBooleanCheckbox > . The value of this selectBooleanCheckbox is associated with the boolean value which is an instance variable of the dataitems through which the data table is iterating. Now, I have a button outside the table clicking which sets the boolean values of all the data items to true, and I would expect that all the selectBooleanCheckbox in the data table would be checked.

      The snippet of my data table is as below

      <rich:dataTable style="border:0px"value="#{SEARCH_RESULTS}" var="hit" id="searchresults" rendered="#{SEARCH_RESULTS != null && not empty SEARCH_RESULTS_SIZE}"
       headerClass="center" width="100%" binding="#{searchResultsBean.data}" rows="20" cellpadding="0" cellspacing="0">
      
       <h:column>
       <h:panelGrid columns="3" border="0" id="searchResultsTable" width="100%" columnClasses="panel" style="border-bottom-style:solid;border-bottom-color:black;border-bottom-width:thin">
      
       <rich:panel style="border:0px;margin:0px">
       <h:selectBooleanCheckbox value="#{hit.selected}" immediate="true" id="selectBox" style="align:center" />
       </rich:panel>
      .....
      ....
      <rich:dataTable>
      
      



      snippet of my select all/deselect all button is as below :


      <a4j:commandButton id="selectAllButton" value="Select All" styleClass="buttons special"
       style="margin:2pt;" action="#{searchResultsBean.selectAll}" reRender="searchresults"/>
      
       <a4j:commandButton value="Deselect All" styleClass="buttons special"
       style="margin:2pt;" id="deSelectAllButton" action="#{searchResultsBean.deselectAll}" reRender="searchresults"/>



      as u can see from my data table code the value of the my check box is "value="#{hit.selected}"
      and when I click my comand button select all Iam doing the follwong action in m y backing bean :

      public String selectAll()
       {
      
       System.out.println("$$$$$$selectall");
       List searchResults = (List) data.getValue();
       Iterator resultsIter = searchResults.iterator();
       while (resultsIter.hasNext())
       {
       SearchResultVO dataItem = (SearchResultVO) resultsIter.next();
       dataItem.setSelected(true);
       }
       selectAllCheckBox = true;
       return "savesearch";
       }



      once the the dataTable is reRendered after this function is called Iam assuming that the check boxes will be all checked, but they r not....if I use a h:dataTable instead of a rich:dataTable it works fine.... Iam kinda clueless as to what is happening... I highly appreciate your response..Thanks in advance