Skip to main content

Adding leaf nodes to tree using jmaki

1 reply [Last post]
Joined: 2008-05-15

I am trying to figure out a way to add child leaf nodes. This has to happen when the parent node is expanded. It fetches the data dynamically using ajax call and shows up the list of child nodes. I can add a node and its child leaf nodes. However I am not sure how to add just the children.

label : 'New Node BB',
expanded : true,
children : [
{label : 'Node B1'},
{label : 'Node B2'}


I want to see 'Node B1' & 'Node B2' but not 'New Node BB' inside target parent.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-02-10

Hi bvb2008,

Did you try the following. Assuming that the id of the parent node is foo.

var node = {
label : 'Single Node',
id : 'node-single',
expanded : true
jmaki.publish("/jmaki/tree/addNodes", { targetId : 'foo', value : node});

I have a set of tests which add nodes and subtrees that you may find helpful See the following directory for those tests: