0 Replies Latest reply on Jul 19, 2011 11:43 AM by mattusey

    Sorted checkbox column in <rich:extendedDataTable>

    mattusey

      RF 3.3; Spring WebFlow

      Here's what I'm trying to do: display a table with a checkbox column with the checked rows initially sorted to the top. When the user checks a checkbox, an ajax call fires to update the back-end. I don't want the table to re-sort.

       

      I implemented this and it worked, except that subsequent checkbox boolean setter methods were called on the wrong objects with subsequent mouse clicks.  It seems as though the table data was re-sorting even though I wasn't rerendering the table.  So I might check and uncheck row 1's checkbox multiple times and the boolean setters for items 1, 6, and 4 would be updated on the back-end instead. On the other hand, if I instead rerender the table with each click, it does re-sort and the clicks operate on the proper rows, but I don't want to do that.

       

      My only option at this point is either to turn off the sorting or to say immediate=true on the <a4j:support> call so that the row elements aren't updated (and thus re-sorted) until the final full submit.  In any case, here's an edited code snippet (assuming I can get this code to paste properly -- BTW, is there a FAQ for inserting code on this forum?):

       

          <rich:extendedDataTable id="attributes" 
              rowKeyVar="rkv" 
              frozenColCount="1" 
              selectionMode="single"
              height="300px"
              value="#{bean.defList}" 
              var="def" 
              sortMode="single"
              binding="#{dataTableScrollerBean.table}"
              selection="#{dataTableScrollerBean.selection}" >
       
              <rich:column id="attrCheckCol" sortBy="#{def.assigned}" 
                      sortOrder="DESCENDING" selfSorted="true" width="80" 
                      label="#{messageSource.AttributeName}">
       
                  <f:facet name="header">
                      <h:outputText styleClass="headerText" value="#{messageSource.BelongToProduct}"/>
                  </f:facet>
       
                  <h:selectBooleanCheckbox id="belongToProductCheckbox"
                                           value="#{def.assigned}" 
                                           title="#{messageSource.BelongToProduct}">
                                           
                      <a4j:support event="onclick" 
                              action="clickAssign"
                              ajaxSingle="true" 
                              immediate="false"
                              limitToList="true">
                              
                          <f:param name="attrId" value="#{def.prop.id}" />
                      
                      </a4j:support>
          
                  </h:selectBooleanCheckbox> 
              </rich:column>
      
       
      
       
      

      Thanks for your time,

       

      Matt Usey