setting.edit.showRemoveBtn.html 2.2 KB

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