Visualizing data with treeTable

The treeTable component visualizes a tree where each tree item can have some additional fields that could be displayed in a tabular format.

How to do it...

The data for the treeTable component is provided with instances of org.primefaces.model.TreeNode, which corresponds to a node in the table.

A basic implementation for a tree table with three columns would be as follows:

<p:treeTable id="simple" value="#{treeTableController.root}" var="element"> <f:facet name="header">Tree Table</f:facet> <p:column> <f:facet name="header">Name</f:facet> <h:outputText value="#{element.name}" /> </p:column> <p:column> <f:facet name="header">Column 1</f:facet> <h:outputText value="#{element.column1}" /> </p:column> <p:column> <f:facet ...

Get PrimeFaces Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.