setting.callback.beforeRemove.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Function(treeId, treeNode)</span><span class="path">setting.callback.</span>beforeRemove</h2>
  4. <h3>Overview<span class="h3_info">[ depends on <span
  5. class="highlight_green">jquery.ztree.exedit</span> js ]</span></h3>
  6. <div class="desc">
  7. <p></p>
  8. <div class="longdesc">
  9. <p>Specify callback function to be called before remove node, The return value controls the allow to
  10. remove node.</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 to be removed.</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 remove node, and will not trigger the 'onRemove'
  23. callback.</p>
  24. </div>
  25. <h3>Examples of setting & function</h3>
  26. <h4>1. disable to remove node</h4>
  27. <pre xmlns=""><code>function myBeforeRemove(treeId, treeNode) {
  28. return false;
  29. }
  30. var setting = {
  31. edit: {
  32. enable: true
  33. },
  34. callback: {
  35. beforeRemove: myBeforeRemove
  36. }
  37. };
  38. ......</code></pre>
  39. </div>
  40. </div>