zTreeObj.selectNode.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Function(treeNode, addFlag)</span><span class="path">zTreeObj.</span>selectNode</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>Select a node</p>
  9. <p class="highlight_red">zTree v3.x supports select multiple nodes.</p>
  10. <p class="highlight_red">Please use zTree object to executing the method.</p>
  11. </div>
  12. </div>
  13. <h3>Function Parameter Descriptions</h3>
  14. <div class="desc">
  15. <h4><b>treeNode</b><span>JSON</span></h4>
  16. <p>JSON data object of the node which will be selected.</p>
  17. <p class="highlight_red">Please ensure that this data object is an internal node data object in zTree.</p>
  18. <h4 class="topLine"><b>addFlag</b><span>Boolean</span></h4>
  19. <p>addFlag = true means: append to select node, don't affect the previously selected node, can select multiple nodes.</p>
  20. <p>addFlag = false means: select single node, prior the selected node is deselected.</p>
  21. <p class="highlight_red">If setting.view.selectedMulti = false, this para, this parameter is not valid, always select single node</p>
  22. <h4 class="topLine"><b>Return </b><span>none</span></h4>
  23. <p>no return value</p>
  24. </div>
  25. <h3>Exampleso of function</h3>
  26. <h4>1. Select single node which be first selected.</h4>
  27. <pre xmlns=""><code>var treeObj = $.fn.zTree.getZTreeObj("tree");
  28. var nodes = treeObj.getNodes();
  29. if (nodes.length>0) {
  30. treeObj.selectNode(nodes[0]);
  31. }
  32. </code></pre>
  33. </div>
  34. </div>