O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – using DataList with pagination

Let us see how we can use the DataList component's pagination support to display five tags per page.

Create a DataList component with pagination support along with a custom paginatorTemplate:

<p:panel header="DataList Pagination">
  <p:dataList value="#{tagController.tags}" var="tag" id="tags" type="none"
    paginator="true" rows="5"
    paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
    rowsPerPageTemplate="5,10,15">
      <f:facet name="header">
        Tags
      </f:facet>
      <h:outputText value="#{tag.id} - #{tag.label}" style="margin-left:10px" />
      <br/>
  </p:dataList>
</p:panel>

What just happened?

We have created a DataList component along ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required