CLIENT GUI Framework
[vnfsdk/refrepo.git] / openo-portal / portal-common / src / main / webapp / common / thirdparty / zTree / api / en / zTreeObj.moveNode.html
1 <div class="apiDetail">\r
2 <div>\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
5         <div class="desc">\r
6                 <p></p>\r
7                 <div class="longdesc">\r
8                         <p>Move the node</p>\r
9                         <p class="highlight_red">Please use zTree object to executing the method.</p>\r
10                 </div>\r
11         </div>\r
12         <h3>Function Parameter Descriptions</h3>\r
13         <div class="desc">\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                 &nbsp;1. the targetNode is the treeNode's parent node, and moveType = "inner"<br/>\r
34                 &nbsp;2. the targetNode is the treeNode's child node.\r
35         </p>\r
36         </div>\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
42 </code></pre>\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
47 </code></pre>\r
48 </div>\r
49 </div>