The example in this article describes the method by which Ztree gets the collection of node nodes in the current selected section. Share to everyone for your reference. The specific analysis is as follows:
requirement: Gets the child Node ID collection for the currently selected node.
Steps:
1. Get the current node
2. Use the Ztree method Transformtoarray () to get a collection of child node objects for the currently selected node (with the selected node).
3. Iterate through the collection to remove the desired value.
TreeNode: Currently selected Node object
function Getchildnodes (TreeNode) {
var navitree = $.fn.ztree.getztreeobj (Ztreeid); var childNodes = Navitree.transformtoarray (treeNode); var New Array (); for (i = 0; i < childnodes.length; i++) { = childnodes[i].id; } return nodes.join (",");}
Ztree method to get the current selection of node nodes ID Collection (reproduced)