treeNode.children.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Array(JSON)</span><span class="path">treeNode.</span>children</h2>
  4. <h3>Overview<span class="h3_info">[ depends on <span
  5. class="highlight_green">jquery.ztree.core</span> js ]</span></h3>
  6. <div class="desc">
  7. <p></p>
  8. <div class="longdesc">
  9. <p>The data collections of node's child nodes.</p>
  10. <p class="highlight_red">1. If change the 'children' to other attribute, please set the
  11. 'setting.data.key.children' attribute.</p>
  12. <p class="highlight_red">2. If you set to use dynamic tree, when a node is expanded which 'isParent'
  13. attribute is true and which has no child nodes, zTree will use ajax to get its child nodes.</p>
  14. <p>Default: undefined</p>
  15. </div>
  16. </div>
  17. <h3>Array(JSON) Format</h3>
  18. <div class="desc">
  19. <p>Standard JSON Data object</p>
  20. </div>
  21. <h3>Examples of treeNode</h3>
  22. <h4>1. Use the standard JSON data object.</h4>
  23. <pre xmlns=""><code>var nodes = [
  24. { "id":1, "name":"test1",
  25. children: [
  26. { "id":3, "name":"test3"},
  27. { "id":4, "name":"test4"},
  28. { "id":5, "name":"test5"}
  29. ]
  30. },
  31. { "id":2, "name":"test2" }
  32. ]</code></pre>
  33. <h4>2. Get the first root node's child nodes</h4>
  34. <pre xmlns=""><code>var treeObj = $.fn.zTree.getZTreeObj("tree");
  35. var nodes = treeObj.getNodes()[0].children;
  36. </code></pre>
  37. </div>
  38. </div>