Ztree specifies the ID node selection and the expansion of the specified ID node, ztree Node

Source: Internet
Author: User

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...
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.