setting.callback.beforeCheck.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Function(treeId, treeNode)</span><span class="path">setting.callback.</span>beforeCheck</h2>
  4. <h3>Overview<span class="h3_info">[ depends on <span
  5. class="highlight_green">jquery.ztree.excheck</span> js ]</span></h3>
  6. <div class="desc">
  7. <p></p>
  8. <div class="longdesc">
  9. <p>Callback before checking or unchecking a node, A false return value from the callback will prevent
  10. any change in the checked state.</p>
  11. <p>Default: null</p>
  12. </div>
  13. </div>
  14. <h3>Function Parameter Descriptions</h3>
  15. <div class="desc">
  16. <h4><b>treeId</b><span>String</span></h4>
  17. <p>zTree unique identifier: <b class="highlight_red">treeId</b>.</p>
  18. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  19. <p>JSON data object of the node which is checked or unchecked</p>
  20. <h4 class="topLine"><b>Return </b><span>Boolean</span></h4>
  21. <p>return true or false</p>
  22. <p class="highlight_red">If return false, zTree will not change the checkbox state, and will not trigger the
  23. 'onCheck' callback.</p>
  24. </div>
  25. <h3>Examples of setting & function</h3>
  26. <h4>1. This example returns false, preventing all checkboxes in the tree from toggling.</h4>
  27. <pre xmlns=""><code>function myBeforeCheckCallBack(treeId, treeNode) {
  28. return false;
  29. };
  30. var setting = {
  31. callback: {
  32. beforeCheck: myBeforeCheckCallBack
  33. }
  34. };
  35. ......</code></pre>
  36. </div>
  37. </div>