setting.callback.beforeEditName.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Function(treeId, treeNode)</span><span class="path">setting.callback.</span>beforeEditName</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 click edit button, The return value controls the
  10. editing of the name.</p>
  11. <p class="highlight_red">This callback is fired when the edit button is clicked, to control the custom
  12. editing operation.</p>
  13. <p>Default: null</p>
  14. </div>
  15. </div>
  16. <h3>Function Parameter Descriptions</h3>
  17. <div class="desc">
  18. <h4><b>treeId</b><span>String</span></h4>
  19. <p>zTree unique identifier: <b class="highlight_red">treeId</b>.</p>
  20. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  21. <p>JSON data object of the node to be edited.</p>
  22. <h4 class="topLine"><b>Return </b><span>Boolean</span></h4>
  23. <p>return true or false</p>
  24. <p class="highlight_red">If return false, allow editing of the name.</p>
  25. </div>
  26. <h3>Examples of setting & function</h3>
  27. <h4>1. disable editing of any parent node's name</h4>
  28. <pre xmlns=""><code>function myBeforeEditName(treeId, treeNode) {
  29. return !treeNode.isParent;
  30. }
  31. var setting = {
  32. edit: {
  33. enable: true
  34. },
  35. callback: {
  36. beforeEditName: myBeforeEditName
  37. }
  38. };
  39. ......</code></pre>
  40. </div>
  41. </div>