[英]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.
当我在树中选择节点时,我需要找到其是否有子节点。
You can check number of child with method getChildCount. 您可以使用方法getChildCount检查孩子的数量。 The
getChildCount()
will return 0 whenever selected node do not contains any children nodes. 每当所选节点不包含任何子节点时,
getChildCount()
将返回0。
public void onNodeSelect(NodeSelectEvent event) {
TreeNode node = event.getTreeNode();
System.out.println("node.getChildCount(): " + node.getChildCount());
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.