1 Reply Latest reply on Jun 29, 2007 2:09 AM by Chico Chen

    Write a custom pagination bar component ?

    Chico Chen Newbie

      I like to Write a custom pagination bar component to replace the following codes.

      Does it mean I will lose the benifit of "f:setPropertyActionListener" tag like below, and need to use parameters like "userQueryCriteria.gotoPage?curPage=#{pn}" ?

      <h:commandLink value="#{pn}" action="#{userQueryCriteria.gotoPage}"
      rendered="#{userQueryCriteria.curPage!=pn}">
      <f:setPropertyActionListener
      target="#{userQueryCriteria.curPage}" value="#{pn}" />
      </h:commandLink>

      =============================================

      dataTable:

      <h:dataTable id="userList"
       value="#{userList}" var="user"
       styleClass="grid maxWidth" headerClass="colHeaderLink" rowClasses="rowAlternate rowNormal" >
       <h:column>
      


      pagination bar:
      <h:commandLink value=" << " action="#{userQueryCriteria.firstPage}"
       rendered="#{userQueryCriteria.previousPageAvailable}" style="text-decoration:none" /> 
      
      <h:commandLink value=" < "
       action="#{userQueryCriteria.previousPage}"
       rendered="#{userQueryCriteria.previousPageAvailable}" style="text-decoration:none" />  
      
      <c:forEach
       begin="1" end="#{userQueryCriteria.totalPage}" var="pn"> 
       <h:commandLink value="#{pn}" action="#{userQueryCriteria.gotoPage}"
       rendered="#{userQueryCriteria.curPage!=pn}">
       <f:setPropertyActionListener
      target="#{userQueryCriteria.curPage}" value="#{pn}" />
       </h:commandLink>
       <h:outputText value="#{pn}"
       rendered="#{userQueryCriteria.curPage==pn}" /> 
      </c:forEach> 
      
      <h:commandLink value=" > "
       action="#{userQueryCriteria.nextPage}"
       rendered="#{userQueryCriteria.nextPageAvailable}" style="text-decoration:none"/>  
      
      <h:commandLink value=" >> " action="#{userQueryCriteria.lastPage}"
       rendered="#{userQueryCriteria.nextPageAvailable}" style="text-decoration:none" />