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>Specify callback function to be called before click edit button, The return value controls the editing of the name.</p>
  9. <p class="highlight_red">This callback is fired when the edit button is clicked, to control 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>.</p>
  17. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  18. <p>JSON data object of the node to be edited.</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, allow editing of the name.</p>
  22. </div>
  23. <h3>Examples of setting & function</h3>
  24. <h4>1. disable editing of any parent node's name</h4>
  25. <pre xmlns=""><code>function myBeforeEditName(treeId, treeNode) {
  26. return !treeNode.isParent;
  27. }
  28. var setting = {
  29. edit: {
  30. enable: true
  31. },
  32. callback: {
  33. beforeEditName: myBeforeEditName
  34. }
  35. };
  36. ......</code></pre>
  37. </div>
  38. </div>