treeNode.open.html 1.6 KB

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