Function(treeNode)zTreeObj.getNodeIndex

Overview[ depends on jquery.ztree.core js ]

Get the node's index in the same level nodes. (start from 0)

Please use zTree object to executing the method.

Function Parameter Descriptions

treeNodeJSON

JSON data object of the node which need to get index.

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

Return Number

return the index. (start from 0)

If there is no this node, return -1.

Examples of function

1. Get the first selected node's index in the same level nodes.

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