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>概述<span class="h3_info">[ 依赖 <span class="highlight_green">jquery.ztree.exedit</span> 扩展 js ]</span></h3>
  5. <div class="desc">
  6. <p></p>
  7. <div class="longdesc">
  8. <p>用于捕获节点编辑按钮的 click 事件,并且根据返回值确定是否允许进入名称编辑状态</p>
  9. <p class="highlight_red">此事件回调函数最主要是用于捕获编辑按钮的点击事件,然后触发自定义的编辑界面操作。</p>
  10. <p>默认值:null</p>
  11. </div>
  12. </div>
  13. <h3>Function 参数说明</h3>
  14. <div class="desc">
  15. <h4><b>treeId</b><span>String</span></h4>
  16. <p>对应 zTree 的 <b class="highlight_red">treeId</b>,便于用户操控</p>
  17. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  18. <p>将要进入编辑名称状态的节点 JSON 数据对象</p>
  19. <h4 class="topLine"><b>返回值</b><span>Boolean</span></h4>
  20. <p>返回值是 true / false</p>
  21. <p class="highlight_red">如果返回 false,节点将无法进入 zTree 默认的编辑名称状态</p>
  22. </div>
  23. <h3>setting & function 举例</h3>
  24. <h4>1. 禁止修改父节点的名称</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>