Liferay DXP Free Tier    |    From download to running in minutes    |    Get started →

Blogs

New Style Paginator of Liferay

Jian Cao
Jian Cao
Menys d'un minut de lectura

A lot of Chinese like some other styles of paginators, this is one I modify the existing jsp page a little to implement it, I think somebody else must have some better ways, please give me some suggestions, thanks. :)

Modify "html\taglib\ui\page_iterator\page\start.jsp"

<div class="search-pages">
   <c:if test='<%= type.equals("regular") %>'>
    <div class="page-selector">
     <liferay-ui:message key="page" />

     

      <%
      int pagesIteratorMax = maxPages;
      int pagesIteratorBegin = 1;
      int pagesIteratorEnd = pages;

      if (pages > pagesIteratorMax) {
       pagesIteratorBegin = curValue - pagesIteratorMax;
       pagesIteratorEnd = curValue + pagesIteratorMax;

       if (pagesIteratorBegin < 1) {
        pagesIteratorBegin = 1;
       }

       if (pagesIteratorEnd > pages) {
        pagesIteratorEnd = pages;
       }
      }

      for (int i = curValue-7; i <= curValue+7; i++) {
       if (i<1){ continue;}

       if(i>pages){continue;}
       
       if (i == curValue){
      %>
      <strong><%=i%></strong>
      <%       
       }
      else
       {
      %>
      <a class="next" href href="<%= _getHREF(formName, curParam, i, jsCall, url, urlAnchor) %>" target="<%= target %>"><%=i%></a>
      <%}
      }
      %>

    

     <liferay-ui:message key="of" />

     <%= numberFormat.format(pages) %>

     <%--<input class="page-iterator-submit" type="submit" value="<liferay-ui:message key="submit" />" />--%>
    </div>
   </c:if>

 

Comentaris de la pàgina

Related Assets...

No s'ha trobat cap resultat

More Blog Entries...

Ben Turner
de novembre 26, 2026
Himanshu Chauhan
de novembre 20, 2026
Tony Lim
de novembre 19, 2026