This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

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: 17030

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Setting selected node of a rich:tree dynamically
It's not a secret anymore!