Copy the node
When copy nodes, zTree v3.x will clone nodes. If you need to get the data object in zTree, please get the return value of this method.
Please use zTree object to executing the method.
JSON data object of the node to be target.
If copy the node to root node, please set the 'targetNode' to null.
Please ensure that this data object is an internal node data object in zTree.
JSON data object of the node to be copied.
Please ensure that this data object is an internal node data object in zTree.
Copied to the target node's relative position.
"inner" means: to be taregetNode's child node.
"prev" means: to be taregetNode's previous sibling node.
"next" means: to be taregetNode's next sibling node.
After copy the node, whether to automatically expand its parent node.
isSilent = true means: don't expand its parent node.
isSilent = false or omit this parameter means: expand its parent node.
return the new node in zTree
Note: the node data JSON object in the return value is not equal to the treeNode.
var treeObj = $.fn.zTree.getZTreeObj("tree");
var nodes = treeObj.getNodes();
treeObj.copyNode(nodes[0], nodes[1], "inner");
var treeObj = $.fn.zTree.getZTreeObj("tree");
var nodes = treeObj.getNodes();
treeObj.copyNode(nodes[0], nodes[1], "before");