TreeTable provides a highly customizable ajax paginator.
<div class="card">
<h:form id="form">
<p:treeTable value="#{ttPaginatorView.root}" var="document" paginator="true" rows="10">
<p:column headerText="Name">
<h:outputText value="#{document.name}"/>
</p:column>
<p:column headerText="Size">
<h:outputText value="#{document.size} KB"/>
</p:column>
<p:column headerText="Type">
<h:outputText value="#{document.type}"/>
</p:column>
</p:treeTable>
</h:form>
</div>
@Named("ttPaginatorView")
@ViewScoped
public class PaginatorView implements Serializable {
private TreeNode<Document> root;
@PostConstruct
public void init() {
root = new DefaultTreeNode();
for (int i = 0; i < 50; i++) {
TreeNode node = new DefaultTreeNode(new Document("Node " + i, String.valueOf((int) (Math.random() * 1000)), "Document"), root);
for (int j = 0; j < 5; j++) {
new DefaultTreeNode(new Document("Node " + i + "." + j, String.valueOf((int) (Math.random() * 1000)), "Document"), node);
}
}
}
public TreeNode getRoot() {
return root;
}
}