Function(treeNode, addFlag)zTreeObj.selectNode

Overview[ depends on jquery.ztree.core js ]

Select a node

zTree v3.x supports select multiple nodes.

Please use zTree object to executing the method.

Function Parameter Descriptions

treeNodeJSON

JSON data object of the node to be selected.

Please ensure that this data object is an internal node data object in zTree.

addFlagBoolean

addFlag = true means: append to select node, don't affect the previously selected node, can select multiple nodes.

addFlag = false means: select single node, prior the selected node is deselected.

If setting.view.selectedMulti = false, this para, this parameter is not valid, always select single node

Return none

no return value

Exampleso of function

1. Select single node which be first selected.

var treeObj = $.fn.zTree.getZTreeObj("tree");
var nodes = treeObj.getNodes();
if (nodes.length>0) {
	treeObj.selectNode(nodes[0]);
}