Skip to main content

Add a node to a tree

3 replies [Last post]
dinamlab
Offline
Joined: 2005-09-20

Hi my question its about a tree, now im using a dojo tree, I need to add a node to a tree when I sumbit a form, can I do this with the glue.js?

Let me redefine my question, I got a tabbed view one got a tree, when you click on a node you can modify data from that node, but in the other tab I got a form to insert data to a database, when i return to the tree view in the other tab, i want to refresh the tree, its that posible?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmurray71
Offline
Joined: 2003-07-31

Currently you would need to modify the widget itself dojo/tree/component.js to add nodes to a tree.

We do not have a a reload/add/remove/delete capibilites though I think it would be a good requiement in our functional specificaiton.

http://wiki.java.net/bin/view/Projects/JMakiTreeFunctionalSpec

Any other htings you would like to do with a Tree?

mk_hh
Offline
Joined: 2007-06-26

getSelectedNode and getParent are necessary

hat27533
Offline
Joined: 2006-03-16

This is how I did it...
By "grafting" nodes dynamically the data is a JSON string from a bean something like this :-

{"root":[{"parentID":["_0"],"label":["Finance"],"id":["root_Finance_140101"]},
{"parentID":["root_Finance_140101"],"label":["Accounts Receivable"],"id":["root_Finance_Accounts Receivable_140118"]} .......]}

in my jsp


value="{
root : {
label : 'Folders',
expanded : true,
id : '_0'
}
}"/>

see http://wiki.java.net/bin/view/Projects/jMakiTreeDataModel there are sections on adding and removing nodes
........
Hope this makes sense !