setting.callback.beforeEditName.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 class="highlight_green">jquery.ztree.exedit</span> js ]</span></h3>
  5. <div class="desc">
  6. <p></p>
  7. <div class="longdesc">
  8. <p>Used to capture the event before click edit button, zTree based on return value to determine whether to allow to edit the name.</p>
  9. <p class="highlight_red">This callback is used to capture the event which edit button is clicked, then trigger the custom editing operation.</p>
  10. <p>Default: null</p>
  11. </div>
  12. </div>
  13. <h3>Function Parameter Descriptions</h3>
  14. <div class="desc">
  15. <h4><b>treeId</b><span>String</span></h4>
  16. <p>zTree unique identifier: <b class="highlight_red">treeId</b>, easy for users to control.</p>
  17. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  18. <p>JSON data object of the node which will be edited name.</p>
  19. <h4 class="topLine"><b>Return </b><span>Boolean</span></h4>
  20. <p>return true or false</p>
  21. <p class="highlight_red">If return false, the node will not be able to edit the name.</p>
  22. </div>
  23. <h3>Examples of setting & function</h3>
  24. <h4>1. disable to edit the parent node's name</h4>
  25. <pre xmlns=""><code>function zTreeBeforeEditName(treeId, treeNode) {
  26. return !treeNode.isParent;
  27. }
  28. var setting = {
  29. edit: {
  30. enable: true
  31. },
  32. callback: {
  33. beforeEditName: zTreeBeforeEditName
  34. }
  35. };
  36. ......</code></pre>
  37. </div>
  38. </div>