treeNode.open.html 1.3 KB

123456789101112131415161718192021222324252627282930
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Boolean</span><span class="path">treeNode.</span>open</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>Used to record the parent node's expand status.</p>
  9. <p class="highlight_red">1. When zTree initialize the node data, if you set treeNode.open = true, zTree will default expand this parent node.</p>
  10. <p class="highlight_red">2. Leaf node's 'open' attribute is false.</p>
  11. <p class="highlight_red">3. In order to solve the problem of someone make json data, supporting "false", "true" format of the data string.</p>
  12. <p class="highlight_red">4. When setting.async.enable = false, the parent node will be expanded which have no child nodes and its attribute 'open' is true. (v3.5.15+) </p>
  13. <p>Default: false</p>
  14. </div>
  15. </div>
  16. <h3>Boolean Format</h3>
  17. <div class="desc">
  18. <p> true means: the parent node is expanded.</p>
  19. <p> false means: the parent node is collapsed.</p>
  20. </div>
  21. <h3>Examples of treeNode</h3>
  22. <h4>1. Get the first selected node's expand status.</h4>
  23. <pre xmlns=""><code>var treeObj = $.fn.zTree.getZTreeObj("tree");
  24. var sNodes = treeObj.getSelectedNodes();
  25. if (sNodes.length > 0) {
  26. var isOpen = sNodes[0].open;
  27. }
  28. </code></pre>
  29. </div>
  30. </div>