PDA

View Full Version : Adding Tree Values to Children of a tree



nywebsol
6 Jan 2012, 1:41 PM
var campaignChildren = [{
text: 'Campaigns',
children: [{
text: 'Search Campaign',
leaf: true
}, {
text: 'Add Campaign',

expanded: true,
children: [{
text: 'Campaign Settings',
leaf: true
} ]
}
]
}];

I am trying to add nodes programatically to be a sibling of 'Campaign Settings'

Kind of a nubie and struggling a little.

Defining the nodes is done. I just can't figure out how to make them siblings of "Campaign Settings"

Any help is much appreciated

mitchellsimoens
6 Jan 2012, 2:20 PM
If you want to add nodes to another nodes, use the appendChild method on the node.

nywebsol
9 Jan 2012, 5:19 AM
What would the syntax be.. because i tried
:
tree.getRootNode().childNodes[0].appendChild(treeChildrenHidden);
tree.doLayout();

Nothing happens at all. and if i do it from the root.. it doesn't add it to the right level