0 Replies Latest reply on Jan 10, 2008 10:25 AM by Dan Levitan

    RichFaces pagination with datascroller

    Dan Levitan Newbie

      Hi,
      I am handling a simple data table with a scroller, for which I would like to have the current page number for several client-side manipulations. I use rich:datascroller with the attribute 'pageIndexVar' for that.
      But, I can't seem to get the scope variable for that - any idea? i'd appreciate any help. Regards, Adi
      Here's my code:

      <rich:dataTable id="dataTable" value="#{DataBean.items}"
      columnClasses="nameCol, nameCol, addressCol"
      headerClass="sortHeader" rows="#{DataBean.visibleRows}"
      var="account" width="100%"
      onRowMouseOver="this.style.backgroundColor='#FBF7E6'">
      <rich:column>
      <f:facet name="header">
      <h:outputText value="" />
      </f:facet>
      <h:selectBooleanCheckbox value="#{account.selected}" />
      </rich:column>
      <rich:column sortable="true">
      <f:facet name="header">
      <h:panelGrid columns="2">
      <a4j:commandLink
      value="#{Message.ACCOUNT_NAME}"
      styleClass="sortHeader" action="#{DataBean.sortName}" reRender="dataTable" />
      <h:graphicImage url="#{DataBean.ascending ? '/images/up.gif' : '/images/down.gif'}" rendered="#{DataBean.sortColumn eq 'account'}" />
      </h:panelGrid>
      </f:facet>
      <h:outputText value="#{account.name}" />
      </rich:column>
      <rich:column>
      <f:facet name="header">
      <h:panelGrid columns="2">
      <a4j:commandLink value="#{Message.ACCOUNT_ADDRESS}" styleClass="sortHeader"
      action="#{DataBean.sortAddress}" reRender="dataTable" />
      <h:graphicImage
      url="#{DataBean.ascending ? '/images/up.gif' : '/images/down.gif'}" rendered="#{DataBean.sortColumn eq 'address'}" />
      </h:panelGrid>
      </f:facet>
      <h:outputText value="#{account.address}" />
      </rich:column>
      </rich:dataTable>

      <%-- Scroller --%>
      <rich:datascroller pageIndexVar="pageIndex" pagesVar="pages"
      id="datascroller" maxPages="10" renderIfSinglePage="false"
      for="dataTable">
      </rich:datascroller>