Visualizing data with TreeTable
TreeTable is used to display hierarchical data in a tabular format. It requires an array of TreeNode
objects as its value and provides a TreeNode
API with many optional properties. TreeTable defines column components as child elements with header
, footer
, field
, and style
attributes similar to DataTable component.
A basic example of a TreeTable component with tourist place tree nodes as information would be written as follows:
<p-treeTable [value]="basicTreeTable"> <p-header>Basic</p-header> <p-column field="name" header="Name"></p-column> <p-column field="days" header="Days"></p-column> <p-column field="type" header="Type"></p-column> </p-treeTable>
The component is created by arranging TreeNode
objects in a hierarchical manner. The TreeNode
object consists of many properties as listed here:
Name | Type | Default | Description |
|
|
| Label of the node. |
|
|
| Data represented by the node. |
|