1 <div class="apiDetail">
\r
3 <h2><span>Function(targetNode, treeNode, moveType, isSilent)</span><span class="path">zTreeObj.</span>moveNode</h2>
\r
4 <h3>Overview<span class="h3_info">[ depends on <span class="highlight_green">jquery.ztree.exedit</span> js ]</span></h3>
\r
7 <div class="longdesc">
\r
9 <p class="highlight_red">Please use zTree object to executing the method.</p>
\r
12 <h3>Function Parameter Descriptions</h3>
\r
14 <h4><b>targetNode</b><span>JSON</span></h4>
\r
15 <p>JSON data object of the node which will be target.</p>
\r
16 <p class="highlight_red">If move the node to root node, please set the 'targetNode' to null.</p>
\r
17 <p class="highlight_red">Please ensure that this data object is an internal node data object in zTree.</p>
\r
18 <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
\r
19 <p>JSON data object of the node which will be moved.</p>
\r
20 <p class="highlight_red">Please ensure that this data object is an internal node data object in zTree.</p>
\r
21 <h4 class="topLine"><b>moveType</b><span>String</span></h4>
\r
22 <p>Moved to the target node's relative position.</p>
\r
23 <p class="highlight_red">"inner" means: to be taregetNode's child node.</p>
\r
24 <p class="highlight_red">"prev" means: to be taregetNode's previous sibling node.</p>
\r
25 <p class="highlight_red">"next" means: to be taregetNode's next sibling node.</p>
\r
26 <h4 class="topLine"><b>isSilent</b><span>Boolean</span></h4>
\r
27 <p>After move the node, whether to automatically expand its parent node.</p>
\r
28 <p>isSilent = true means: don't expand its parent node.</p>
\r
29 <p>isSilent = false or omit this parameter means: expand its parent node.</p>
\r
30 <h4 class="topLine"><b>Return </b><span>JSON</span></h4>
\r
31 <p>return the node which be moved, it is same as the 'treeNode' parameter.</p>
\r
32 <p class="highlight_red">Return null means: move node has failed. The cause:<br/>
\r
33 1. the targetNode is the treeNode's parent node, and moveType = "inner"<br/>
\r
34 2. the targetNode is the treeNode's child node.
\r
37 <h3>Examples of function</h3>
\r
38 <h4>1. Move the second root node to the first root node's child node.</h4>
\r
39 <pre xmlns=""><code>var treeObj = $.fn.zTree.getZTreeObj("tree");
\r
40 var nodes = treeObj.getNodes();
\r
41 treeObj.moveNode(nodes[0], nodes[1], "inner");
\r
43 <h4>2. Move the second root node to the first root node's previous sibling node.</h4>
\r
44 <pre xmlns=""><code>var treeObj = $.fn.zTree.getZTreeObj("tree");
\r
45 var nodes = treeObj.getNodes();
\r
46 treeObj.moveNode(nodes[0], nodes[1], "prev");
\r