You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Ach <as...@gmail.com> on 2006/08/12 14:36:29 UTC

How to add child to node in tree2?

Hi all,
 I have a tree2 component with checkboxes on nodes. And a add button in my
form and want to add a childeren to checked node when I press ADD button.
 I do not know how to know which node is checked and how to generate the
code for adding child node. Your help is so appreciated friends.
 -Thanks

-- 
View this message in context: http://www.nabble.com/How-to-add-child-to-node-in-tree2--tf2095094.html#a5775288
Sent from the MyFaces - Users forum at Nabble.com.


Re: How to add child to node in tree2?

Posted by Mike Kienenberger <mk...@gmail.com>.
On 8/12/06, Ach <as...@gmail.com> wrote:
>  I have a tree2 component with checkboxes on nodes. And a add button in my
> form and want to add a childeren to checked node when I press ADD button.
>  I do not know how to know which node is checked and how to generate the
> code for adding child node. Your help is so appreciated friends.

To add a child, your node simply needs to return it when getChildren is called.
So how to add a child depends on your implemenation of Node.getChildren().

I don't know how you can determine which node is checked -- again that
probably depends on how your application set up the node.

I do know that you can determine which node is clicked like this:

    	Node node = (Node)treeUI.getNode();

where binding="#{yourBean.treeUI}"