2 Replies Latest reply on Mar 12, 2010 5:24 PM by Nick Belaevski

    Pagination for <rich:scrollableDataTable ,on Selection

    Sandeep Gowda Newbie

      hi,

       

      I had to display 1000 recods  so i have used pagination(15 rows per page), but if i go to second page and on selection, below code returns me

      index between 1-15,, but i require exactly index of whole collection.

       

      usecase with example:

             i select 2 page of the pagination and if i select 3rd row,then my selection index has to be 18, but its returning 2.

       

       

      can you help me.

       

      //in corresponding bean on single row selection java code.

       

      Object key = tableselection.getActiveRowKey();

       

              tableselection.getData();

       

      //        tableselection.getRowData();

       

              tableselection.getRowKey();

       

              Iterator<Object> iterator = getSelection().getKeys();

       

              while (iterator.hasNext()) {

       

                  Integer key1 = (Integer) iterator.next();
                 
                  tableselection.setRowKey(key1);
                 
                  getLstSelectedCustomerProperties().add(
                          (CustomerAttributes) tableselection.getRowData());

       

              }

       

       

      //JSF page code as below

       

      <rich:scrollableDataTable rowKeyVar="rkv" height="400px"
                                  width="700px" id="customerRecordList" rows="15"
                                  columnClasses="col"
                                  value="#{searchCustomerBean.lstCustomerProperties}"
                                  var="category" sortMode="single"
                                  binding="#{searchCustomerBean.tableselection}"
                                  selection="#{searchCustomerBean.selection}"
                                  reRender="buttonPanel,pagination">

       

                           <rich:column id="RegistrationNo" width="120px" sortable="false">
                                      <f:facet name="header">
                                          <h:outputText styleClass="headerText" value="Registration No" />
                                      </f:facet>
                                      <h:outputText value="#{category.strSelectedRegistrationNo}" />
                                  </rich:column>
                                  <rich:column id="DateOfBirth" width="60px" sortable="false">
                                      <f:facet name="header">
                                          <h:outputText styleClass="headerText" value="DOB" />
                                      </f:facet>
                                      <h:outputText value="#{category.strSelectedDTOfBirth}" />
                                  </rich:column>

       

       

                                <f:facet name="footer">
                                      <rich:datascroller style="width:700px" id="pagination"
                                          renderIfSinglePage="false"></rich:datascroller>
                                  </f:facet>
           </rich:scrollableDataTable>

       

       

      regards

      Sandeep