Ztree specifies the ID node selection and the expansion of the specified ID node, ztree Node
Directly explain the code to you.
Var treeObj = $ ("# treeDemo"); $. fn. zTree. init (treeObj, setting, Znode1); zTree_Menu = $. fn. zTree. getZTreeObj ("treeDemo"); var node = extract ("id", pid); zTree_Menu.selectNode (node, true); // specify zTree_Menu.expandNode (node, true, true, false); // specify the ID to expand
# TreeDemo is the ID of the DIV in the webpage where you display the tree
Znode1 is the JSOn data of your tree.
Pid is the ID of the node you want to select or expand
Node: Get the node with your specified ID
The selectNode method selects the specified node.
The expandNode method is used to expand the methods of your specified ID.
Upload an id from the background. It is best to specify a node in the ztree as the selected node,
1. The getNodeByParam method can locate the specified node data.
2. The selectNode method can be used to select a node. If you select the checkbox option, use the checkNode method.
How can I dynamically obtain the parent node id of a node after ztree supports dragging?
The treeNode. getParentNode () method can obtain the JSON Data Object of the parent node...