Visualizing data with tree
The tree
component visualizes hierarchical data in the tree format.
How to do it…
The data for tree
is provided as instances of org.primefaces.model.TreeNode
, which correspond to the nodes in the tree. A pure client-side tree might be useful to create tree-based navigation menus. A basic data model for a tree could be constructed as follows:
TreeNode root = new DefaultTreeNode("Root", null); TreeNode node1 = new DefaultTreeNode("Node1", root); TreeNode node2 = new DefaultTreeNode("Node2", root); TreeNode node11 = new DefaultTreeNode("Node1.1", node1); TreeNode node12 = new DefaultTreeNode("Node1.2", node1); TreeNode node21 = new DefaultTreeNode("Node2.1", node2); TreeNode node211 = new DefaultTreeNode("Node2.1.1", node21); ...
Get PrimeFaces Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.