I have three nodes in the tree and would like to keep the first node expanded, is there a way in dojo tree which would support this?
Thanks.
I have three nodes in the tree and would like to keep the first node expanded, is there a way in dojo tree which would support this?
Thanks.
In the above case the expandNodeId is the ID that you assigned to the node that was clicked. So, in your onClick() function you can do something like this;
var theTree = new Tree({
model: myModel,
onClick: function(item, node){
// auto-expand the node when clicked
var nodes = that.theTree.getNodesByItem(item.id);
if(!nodes[0].isExpanded)
theTree._expandNode(nodes[0]);
}
});
If you have id of the node that you want to expand. you can expand that node as follows - myTree will be your tree and expandNodeId is the id of the node you want to expand.