setting.edit.showRenameBtn.html 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Boolean / Function(treeId, treeNode)</span><span class="path">setting.edit.</span>showRenameBtn</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 rename button. It is valid when <span class="highlight_red">[setting.edit.enable = true]</span>
  10. </p>
  11. <p>When you click the rename button:</p>
  12. <p>1. Click the rename button, you can rename the node.</p>
  13. <p>2. After rename operation (the input DOM blur or press the Enter Key), zTree will trigger the <span
  14. class="highlight_red">setting.callback.beforeRename</span> callback, and you can decide whether
  15. to allow rename.</p>
  16. <p>3. If the 'beforeRename' callback return false, so zTree will keep the edit status. (Press the ESC
  17. key, can be restored to the original state.</p>
  18. <p>4. If you don't set the 'beforeRename' or the 'beforeRename' callback return true, so zTree will
  19. trigger the <span class="highlight_red">setting.callback.onRename</span> callback after rename the
  20. node.</p>
  21. <p>Default: true</p>
  22. </div>
  23. </div>
  24. <h3>Boolean Format</h3>
  25. <div class="desc">
  26. <p> true means: show the rename button</p>
  27. <p> false means: hide the rename button</p>
  28. </div>
  29. <h3>Function Parameter Descriptions</h3>
  30. <div class="desc">
  31. <h4><b>treeId</b><span>String</span></h4>
  32. <p>zTree unique identifier: <b class="highlight_red">treeId</b>.</p>
  33. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  34. <p>JSON data object of the node which show the rename button</p>
  35. <h4 class="topLine"><b>Return </b><span>Boolean</span></h4>
  36. <p>Return value is same as 'Boolean Format'</p>
  37. </div>
  38. <h3>Examples of setting & function</h3>
  39. <h4>1. Hide the rename button</h4>
  40. <pre xmlns=""><code>var setting = {
  41. edit: {
  42. enable: true,
  43. showRenameBtn: false
  44. }
  45. };
  46. ......</code></pre>
  47. <h4>2. Hide the rename button of parent node</h4>
  48. <pre xmlns=""><code>function setRenameBtn(treeId, treeNode) {
  49. return !treeNode.isParent;
  50. }
  51. var setting = {
  52. edit: {
  53. enable: true,
  54. showRenameBtn: setRenameBtn
  55. }
  56. };
  57. ......</code></pre>
  58. </div>
  59. </div>