setting.edit.showRemoveBtn.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Boolean / Function(treeId, treeNode)</span><span class="path">setting.edit.</span>showRemoveBtn</h2>
  4. <h3>Overview<span class="h3_info">[ depends on <span class="highlight_green">jquery.ztree.exedit</span> js ]</span></h3>
  5. <div class="desc">
  6. <p></p>
  7. <div class="longdesc">
  8. <p>Set to show or hide the remove button. It is valid when <span class="highlight_red">[setting.edit.enable = true]</span></p>
  9. <p>When you click the remove button:</p>
  10. <p>1. zTree will trigger the <span class="highlight_red">setting.callback.beforeRemove</span> callback, and you can decide whether to allow delete.</p>
  11. <p>2. If you don't set the 'beforeRemove' or the 'beforeRemove' callback return true, so zTree will trigger the <span class="highlight_red">setting.callback.onRemove</span> callback after remove the node.</p>
  12. <p>Default: true</p>
  13. </div>
  14. </div>
  15. <h3>Boolean Format</h3>
  16. <div class="desc">
  17. <p> true means: show the remove button</p>
  18. <p> false means: hide the remove button</p>
  19. </div>
  20. <h3>Function Parameter Descriptions</h3>
  21. <div class="desc">
  22. <h4><b>treeId</b><span>String</span></h4>
  23. <p>zTree unique identifier: <b class="highlight_red">treeId</b>.</p>
  24. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  25. <p>JSON data object of the node which show the remove button</p>
  26. <h4 class="topLine"><b>Return </b><span>Boolean</span></h4>
  27. <p>Return value is same as 'Boolean Format'</p>
  28. </div>
  29. <h3>Examples of setting & function</h3>
  30. <h4>1. Hide the remove button</h4>
  31. <pre xmlns=""><code>var setting = {
  32. edit: {
  33. enable: true,
  34. showRemoveBtn: false
  35. }
  36. };
  37. ......</code></pre>
  38. <h4>2. Hide the remove button of parent node</h4>
  39. <pre xmlns=""><code>function setRemoveBtn(treeId, treeNode) {
  40. return !treeNode.isParent;
  41. }
  42. var setting = {
  43. edit: {
  44. enable: true,
  45. showRemoveBtn: setRemoveBtn
  46. }
  47. };
  48. ......</code></pre>
  49. </div>
  50. </div>