Reputation: 305
I have the rowkey(say 0_0,0_1,etc) of treenodes, now is there any simple way to get the node with that rowkey or we need to iterate over entire treenode.
the below code doesn't work
private TreeNode getNode(TreeNode node, String key) {
for(TreeNode child : node.getChildren()){
if(key.equals(child.getRowKey()))
return child;
return getNode(child,key);
}
return null;
}
Upvotes: 2
Views: 813
Reputation: 1796
to make it short as possible it's impossible to get the node
with the rowkey
because the type of informations that you pass from your JSF
page to your been
it's a String
one that mean it's impossible to retrieve any data from this informations, like you said in your question the only solution that you have is to loop in your tree
to search for it.
Upvotes: 1