aspose file tools*
The moose likes JSF and the fly likes Setting selected node of a rich:tree dynamically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Setting selected node of a rich:tree dynamically" Watch "Setting selected node of a rich:tree dynamically" New topic

Setting selected node of a rich:tree dynamically

zul' Zorander

Joined: Aug 12, 2009
Posts: 21
Is there any way to set selected node of a rich tree dynamically based on a action event??
I have a boolean checkbox enclosed within a tree node and i need to set selected tree node based on checkbox selection. I tried using advisenodeselected but that didnt give correct functionality. I tried triggering click event on tree on checkbox selection and tried to set advicenodeselected on tree click. But the problem I am facing is the node above or below the desired node is getting selected. From what I understand is that the method binding to advisenodeselected executes once for each node and based on return value the node is selected.
But for the click the method is called number of nodes+1 times. I am thinking that the tree needs to deselect the selected node before selecting a new node. But the problem I am facing is the for the tree click the method is executing number of nodes times some times and +1 some time leading to the above or below node the desired node to be selected.
Please explain the reason behind this

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15665

No, you can have multiple nodes open at the same time.

What you need is to provide the "node displayed" method on the server and let it instruct the client whether a given node is open or not. It gets called for each node that might display itself or its children.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: Setting selected node of a rich:tree dynamically
Similar Threads
JTree Vertically half displayed problem
multiple node selection in jtree
I could not expand myfaces tree
jsf tree with checkbox
How do you implement Tomahawk tree control with a CheckBox?