treeNode.children.html 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Array(JSON)</span><span class="path">treeNode.</span>children</h2>
  4. <h3>概述<span class="h3_info">[ 依赖 <span class="highlight_green">jquery.ztree.core</span> 核心 js ]</span></h3>
  5. <div class="desc">
  6. <p></p>
  7. <div class="longdesc">
  8. <p>节点的子节点数据集合。</p>
  9. <p class="highlight_red">1、如果不使用 children 属性保存子节点数据,请修改 setting.data.key.children </p>
  10. <p class="highlight_red">2、异步加载时,对于设置了 isParent = true 的节点,在展开时将进行异步加载</p>
  11. <p>默认值:无</p>
  12. </div>
  13. </div>
  14. <h3>Array(JSON) 格式说明</h3>
  15. <div class="desc">
  16. <p>标准的 JSON 数据对象</p>
  17. </div>
  18. <h3>treeNode 举例</h3>
  19. <h4>1. 初始化的标准嵌套格式的 JSON 数据对象</h4>
  20. <pre xmlns=""><code>var nodes = [
  21. { "id":1, "name":"test1",
  22. children: [
  23. { "id":3, "name":"test3"},
  24. { "id":4, "name":"test4"},
  25. { "id":5, "name":"test5"}
  26. ]
  27. },
  28. { "id":2, "name":"test2" }
  29. ]</code></pre>
  30. <h4>2. 获取第一个根节点的子节点</h4>
  31. <pre xmlns=""><code>var treeObj = $.fn.zTree.getZTreeObj("tree");
  32. var nodes = treeObj.getNodes()[0].children;
  33. </code></pre>
  34. </div>
  35. </div>