1 Reply Latest reply on Dec 18, 2009 6:21 AM by Ilya Shaikovsky

    Maintaining selection with datascroller

    Jeff Prince Newbie

      I have a extendedDataTable with an associated dataScroller.  I have implemented my own version of ExtendedTableDataModel so that I can handle selection, sorting and filtering.  Everything is working great; I'm able to select a row, sort and filter and the selected rows remain selected.  The only problem I'm running into is that the selected rows are not maintained when I use the dataScroller to go to another page.  The selected rows are not saved to the backing bean when the scroller scrolls.  Does anybody know a way to do this?

       

      Here's the code for the table.

       

      <rich:extendedDataTable rowKeyVar="rkv" height="321px" width="450px" binding="#{myBean.myTable}"
                     cellpadding="5" border="0" var="row" id="myTable" 
                     value="#{myBean.myTableDataModel}" 
                     sortMode="single" selectionMode="multi" 
                     selection="#{myBean.selectedRows}"
                     rows="10" enableContextMenu="false" frame="border">
      
           <f:facet name="header">
                <rich:datascroller
                           fastControls="hide" 
                           stepControls="auto"
                           boundaryControls="auto" 
                           selectedStyle="font-weight: bolder;" 
                           id="myScroller" 
                           for="myTable"
                           maxPages="5" 
                           align="right" 
                           renderIfSinglePage="false"
                           pageIndexVar="index"
                           pagesVar="pages"
                           page="#{myBean.curPageIndex}">
                                                                
                     <f:facet name="pages">
                          <h:panelGrid columns="3">
                               <h:outputText value="Page "/>
                               <h:inputText id="scrollerInput" value="#{myBean.curPageIndex}"   
                                         onchange="goToPage(this, #{rich:component('myScroller')}, #{myBean.curPageIndex}, this.value, #{pages});"
                                         />
                               <h:outputText value=" of #{pages}" />
                          </h:panelGrid>
                               </f:facet>
                     </rich:datascroller>                                        
           </f:facet>