O'Reilly logo

PrimeFaces Cookbook - Second Edition by Oleg Varaksin, Mert Çalışkan

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

Visualizing data with treeTable

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

How to do it…

A basic implementation for treeTable with three columns would be as follows:

<p:treeTable id="simple" value="#{treeTableBean.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 name="header">Column 2</f:facet>
    <h:outputText value="#{element.column2}" />
  </p:column>
</p:treeTable>

The visual output of the table expanded on every ...

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