Home > Web Front-end > JS Tutorial > body text

Ztree method to obtain the child node id collection of the currently selected node_javascript skills

WBOY
Release: 2016-05-16 16:14:24
Original
1355 people have browsed it

The example in this article describes how ztree obtains the set of child node ids of the currently selected node. Share it with everyone for your reference. The specific analysis is as follows:

Requirements: Get the set of child node ids of the currently selected node.

Steps:

1. Get the current node

2. Use the ztree method transformToArray() to obtain the collection of child node objects of the currently selected node (including the selected node).

3. Traverse the collection and retrieve the required values.

treeNode: currently selected node object

function getChildNodes(treeNode) {
     var childNodes = ztree.transformToArray(treeNode);
     var nodes = new Array();
     for(i = 0; i < childNodes.length; i++) {
          nodes[i] = childNodes[i].id;
     }
     return nodes.join(",");
}
Copy after login

I hope this article will be helpful to everyone’s JavaScript programming design.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template