There will cases where you will need to add tree nodes on a tree dynamically. In order to do so you need to create the tree widget and use the "onexpand" event as illustrated below:
<tree width="150" onexpand="app.addNode" xmlns="http://www.innoscript.org/quix"> <treenode caption="test" id="test" haschildren="true"> </treenode> </tree>
Next step is to add the event handler in the javascript file as such:
app.addNode = function(nodeclicked) { var newnode = new TreeNode({ caption: 'myCaption', haschildren: true }); nodeclicked.appendChild(newnode); newnode.redraw(); }
Note that what is been redrawn is the newnode that we created and not the node which fired the event (nodeclicked).