goku
goku

Reputation: 223

How can I find is there is child having in tree component or not in PrimeFaces

I need to find whether the tree in primeface have child or not . When I select node in tree I need to find its having child or not.

Upvotes: 1

Views: 979

Answers (1)

wittakarn
wittakarn

Reputation: 3164

You can check number of child with method getChildCount. The getChildCount() will return 0 whenever selected node do not contains any children nodes.

public void onNodeSelect(NodeSelectEvent event) {
    TreeNode node = event.getTreeNode();
    System.out.println("node.getChildCount(): " + node.getChildCount());
}

Upvotes: 2

Related Questions