Checkbox Tree - TreeNode.isSelected() not correct

UI Components for JSF
Post Reply
christophenoel
Posts: 11
Joined: 23 Jan 2014, 11:41

31 Aug 2016, 15:16

When using the Primefaces tree using a checkbox selection, the selection variable (TreeNode[]) in fact duplicates the information already contains in the TreeNode itself.
It simply list the selected node from any level in the hierarchy.

Therefore,the level of the element is unknown and so it is sometimes more useful to make profit of the value TreeNode, and use getChildren() to browse the Tree and handle the selection.

To know if a leaf is selected, it seems logical to use the method node.isSelected(). But in practice, it is a bit different: a leaf is indeed selected only when leaf.isSelected OR IF leaf.getParent().isSelected().

It seems the implementation do not call setSelected(true) for the children when itself it gets selected.
Currently using Primefaces 6.0 in Liferay 6.2 GA4 (JSF 2.2)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 51 guests