Function(parentNode)zTreeObj.removeChildNodes

Overview[ depends on jquery.ztree.exedit js ]

Remove a parent node's child nodes

1. After remove child nodes, the parent node will become a leaf node. Such as the need to maintain the parent node is still a parent node, set 'setting.data.keep.parent' attribute.

2. Do not use this method to empty the root. If you need to empty the root, you can initialization zTree, and set the initial nodes is null.

3. This method does not trigger any callback function.

Please use zTree object to executing the method.

Function Parameter Descriptions

parentNodeJSON

The parent node which need to clear its child nodes.

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

Return Array(JSON)

Return the parent node's child nodes which have been removed. If has no child nodes, return null.

Examples of function

1. Remove the first selected node's child nodes

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