try this code:

fileTree = new LinkTree();

TreeNode existingTreeNode = ...;

DefaultMutableTreeNode newTreeNode = new DefaultMutableTreeNode(object);
DefaultTreeModel model = (DefaultTreeModel)fileTree.getModelObject();
model.insertNodeInto(newTreeNode, treeNode, 0);
fileTree.updateTree(target);




Kai Schubert-Altmann wrote:
> 
> Hi,
> 
> how can I add nodes to a wicket tree using a AjaxLink?
> 
> I tried to add a node to the SimpleTree of this example:
> http://www.wicket-library.com/wicket-examples/ajax/tree/simple.1
> 
> with this code:
> 
>         add(new AjaxLink("addNode")
>         {
>             public void onClick(AjaxRequestTarget target)
>             {
>               List list = new ArrayList();
>               list.add("new node");
>               BaseTreePage.this.add(rootNode,list);
>               getTree().updateTree(target);
>             }
>         });
> 
> But the tree will not update itself.
> 
> Thanks in advance,
> Kai
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-add-nodes-to-a-tree-using-Ajax-tp18130191p18150967.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to