setting.callback.beforeExpand.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Function(treeId, treeNode)</span><span class="path">setting.callback.</span>beforeExpand</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>Specify callback function to be called before expanding a node, The return value controls the expand node callback.</p>
  9. <p>Default: null</p>
  10. </div>
  11. </div>
  12. <h3>Function Parameter Descriptions</h3>
  13. <div class="desc">
  14. <h4><b>treeId</b><span>String</span></h4>
  15. <p>zTree unique identifier: <b class="highlight_red">treeId</b>.</p>
  16. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  17. <p>JSON data object of the node to be expanded</p>
  18. <h4 class="topLine"><b>Return </b><span>Boolean</span></h4>
  19. <p>return true or false</p>
  20. <p class="highlight_red">If return false, zTree will not expand node, and will not trigger the 'onExpand' callback.</p>
  21. </div>
  22. <h3>Examples of setting & function</h3>
  23. <h4>1. disables expanding of all nodes</h4>
  24. <pre xmlns=""><code>function myBeforeExpand(treeId, treeNode) {
  25. return false;
  26. };
  27. var setting = {
  28. callback: {
  29. beforeExpand: myBeforeExpand
  30. }
  31. };
  32. ......</code></pre>
  33. </div>
  34. </div>