zTreeObj.removeNode.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Function(treeNode, callbackFlag)</span><span class="path">zTreeObj.</span>removeNode</h2>
  4. <h3>Overview<span class="h3_info">[ depends on <span class="highlight_green">jquery.ztree.core</span> js ]</span></h3>
  5. <div class="desc">
  6. <p></p>
  7. <div class="longdesc">
  8. <p>Remove a node</p>
  9. <p class="highlight_red">Use removeNode() method of zTree v3.x can trigger 'beforeRemove / onRemove' callback function. for reduce redundant code.</p>
  10. <p class="highlight_red">Please use zTree object to executing the method.</p>
  11. </div>
  12. </div>
  13. <h3>Function Parameter Descriptions</h3>
  14. <div class="desc">
  15. <h4><b>treeNode</b><span>JSON</span></h4>
  16. <p>JSON data object of the node to be removed.</p>
  17. <p class="highlight_red">Please ensure that this data object is an internal node data object in zTree.</p>
  18. <h4 class="topLine"><b>callbackFlag</b><span>Boolean</span></h4>
  19. <p>callbackFlag = true means: call this method, will trigger 'beforeRemove' & 'onRemove' callback.</p>
  20. <p>callbackFlag = false means: call this method, will not trigger callback.</p>
  21. <p class="highlight_red">If this parameter is omitted, it is same as 'callbackFlag = false'</p>
  22. <h4 class="topLine"><b>Return </b><span>none</span></h4>
  23. <p>no return value</p>
  24. </div>
  25. <h3>Examples of function</h3>
  26. <h4>1. Remove all of the selected nodes.</h4>
  27. <pre xmlns=""><code>var treeObj = $.fn.zTree.getZTreeObj("tree");
  28. var nodes = treeObj.getSelectedNodes();
  29. for (var i=0, l=nodes.length; i < l; i++) {
  30. treeObj.removeNode(nodes[i]);
  31. }
  32. </code></pre>
  33. </div>
  34. </div>