Search
TreeView.selectNode Method
See Also
 






Selects a TreeNode.

Namespace: MindFusion.Common.UI
File: TreeView.js

 Syntax

JavaScript  Copy Code

function selectNode (node, [selectChildren])

 Parameters

node

The TreeNode instance to select.

selectChildren
Optional.

Boolean. True to select all of the node's children, otherwise false.

 Example

The following code creates a new TreeView element using a <div> element with id "treeview" initialized in an HTML page. Then it creates a TreeNode item and adds it to the items collection of the TreeView. Only the root node is selected.

JavaScript  Copy Code

var treeView = new ui.TreeView(document.getElementById("treeView"));
treeView.width = treeView.height = ui.Unit.percentage(100);
treeView.theme = theme;

// create a tree node that will be a root in our hierarchy
var root = new ui.TreeNode("body");
root.expanded = true;
treeView.items.add(root);

// create a tree node that will be a root in our hierarchy
var head = new ui.TreeNode("head");
root.items.add(head);

treeview.selectNode(body, false);

 See Also