Access a Node

Within Event Handlers

Usually, you need to access a TreeView node when an action was made on it, for example, when it was clicked or selected. This action raises an event, and you can access the node subjected to the action within the event handler.

$(function() {
        dataSource: data,
        onItemClick: function (e) {
            var node = e.node;
            // ...

Not every event handler provides access to the node, only those whose name starts with onItem.... They are described in the TreeView Configuration.

Using a Method

To get TreeView nodes at any point of the application flow, call the getNodes() method.

var allNodes = $("#treeViewContainer").dxTreeView("getNodes");

All node objects contain a similar set of fields, which are described in the Node documentation section.

See Also