Creating event handlers for tree view
For the Tree View component, you can create event handlers for the individual nodes or for the tree as a whole at a global level.
In order to write event handlers for a particular node type in the tree, for example, for the nodes representing departments, perform the following steps:
- In the Properties view for the Tree View, select the Tree Node List tab.
- In the Select nodes to display box, select the type of node for which you want to write the event handler.
- From the right corner, click Create/edit event handlers for node manipulation. This will take you to the Quick Edit view.
- In the left frame of the Quick Edit View, select the event for which you want to write the handler. Events should be onhighlight, onselect, onunselect, onexpand, and oncollapse. If you want an action to occur when the user clicks a node in the tree, use onhighlight. If you have enabled node selection, use onselect/onunselect to define actions for when the user selects or deselects the check box.
- In the right frame, either select an out-of-box event handler using the context menu, or enter in the JavaScript to write a custom event handler.
In order to write an event handler for the tree at a global level, select the entire tree in the Design view, click above or below all nodes, and follow the same procedure as above. Events should be onnodehighlight, onnodedeselect, onnodeunselect, onnodeexpand, and onnodecollapse.
Note: At a global level, you can only write a custom event handler. The out-of-box event handlers are only applicable for the events on the individual nodes in the tree.
Note: To write event handlers for a tree node, click on the top or bottom border of the tree, and switch to Quick Edit View to display the global events. Go back to the Design View, and click on the tree node to display node events in the Quick Edit View.