zTreeObj.reAsyncChildNodesPromise.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Function(parentNode, reloadType, isSilent)</span><span class="path">zTreeObj.</span>reAsyncChildNodesPromise
  4. </h2>
  5. <h3>Overview<span class="h3_info">[ depends on <span
  6. class="highlight_green">jquery.ztree.core</span> js ]</span></h3>
  7. <div class="desc">
  8. <p></p>
  9. <div class="longdesc">
  10. <p>Forced asynchronous loading child nodes of parent node ( for ES6 Promise ). It is valid when <span class="highlight_red">[setting.async.enable = true]</span>
  11. </p>
  12. <p class="highlight_red">You can use this method to reload child nodes.</p>
  13. <p class="highlight_red">Please use zTree object to executing the method.</p>
  14. <p class="highlight_red">v3.5.29+</p>
  15. </div>
  16. </div>
  17. <h3>Function Parameter Descriptions</h3>
  18. <div class="desc">
  19. <h4><b>parentNode</b><span>JSON</span></h4>
  20. <p>The parent node which will asynchronous loading child nodes.</p>
  21. <p class="highlight_red">1. If parentNode = null, it is same as reload root nodes.</p>
  22. <p class="highlight_red">2. If parentNode.isParent = false, don't load nodes.</p>
  23. <p class="highlight_red">3. Please ensure that this data object is an internal node data object in
  24. zTree.</p>
  25. <h4 class="topLine"><b>reloadType</b><span>String</span></h4>
  26. <p>reloadType = "refresh" means: reload child nodes.</p>
  27. <p>reloadType != "refresh" means: append to load child nodes.</p>
  28. <h4 class="topLine"><b>isSilent</b><span>Boolean</span></h4>
  29. <p>Set whether to automatically expand the parent node, after load nodes.</p>
  30. <p>isSilent = true means: don't auto expand the parent node. Otherwise auto expand.</p>
  31. <h4 class="topLine"><b>Return </b><span>ES6 Promise</span></h4>
  32. <p>Promise Object of ES6</p>
  33. </div>
  34. <h3>Examples of function</h3>
  35. <h4>1. reload root nodes</h4>
  36. <pre xmlns=""><code>var treeObj = $.fn.zTree.getZTreeObj("tree");
  37. treeObj.reAsyncChildNodes(null, "refresh");
  38. </code></pre>
  39. <h4>2. reload the first selected node's child nodes.</h4>
  40. <pre xmlns=""><code>var treeObj = $.fn.zTree.getZTreeObj("tree");
  41. var nodes = treeObj.getSelectedNodes();
  42. if (nodes.length>0) {
  43. treeObj.reAsyncChildNodes(nodes[0], "refresh");
  44. }
  45. </code></pre>
  46. </div>
  47. </div>