setting.edit.showRenameBtn.html 2.2 KB

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