setting.callback.onRename.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Function(event, treeId, treeNode, isCancel)</span><span class="path">setting.callback.</span>onRename</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 when remove node.</p>
  9. <p class="highlight_red">1. If you set 'setting.callback.beforeRename',and return false, zTree will keep the editing name, and will not trigger the 'onRename' callback.</p>
  10. <p class="highlight_red">2. If you modity treeNode data, and use 'updateNode' function, zTree will not trigger the 'onRename' callback.</p>
  11. <p class="highlight_red">3. From v3.5.13, zTree will trigger this callback when user cancel edit name. please see 'isCancel' parameter.</p>
  12. <p>Default: null</p>
  13. </div>
  14. </div>
  15. <h3>Function Parameter Descriptions</h3>
  16. <div class="desc">
  17. <h4><b>event</b><span>js event Object</span></h4>
  18. <p>event Object</p>
  19. <h4 class="topLine"><b>treeId</b><span>String</span></h4>
  20. <p>zTree unique identifier: <b class="highlight_red">treeId</b>, easy for users to control.</p>
  21. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  22. <p>JSON data object of the node which was rename.</p>
  23. <h4 class="topLine"><b>isCancel</b><span>Boolean</span></h4>
  24. <p>the status about cancel edit name (v3.5.13+)</p>
  25. <p class="highlight_red">isCancel = true means: user cancel edit name. (press ESC or use cancelEditName() function)</p>
  26. <p class="highlight_red">isCancel = false means: user submit edit name.</p>
  27. </div>
  28. <h3>Examples of setting & function</h3>
  29. <h4>1. When rename node, alert info about 'tId' and 'name'.</h4>
  30. <pre xmlns=""><code>function zTreeOnRename(event, treeId, treeNode, isCancel) {
  31. alert(treeNode.tId + ", " + treeNode.name);
  32. }
  33. var setting = {
  34. callback: {
  35. onRename: zTreeOnRename
  36. }
  37. };
  38. ......</code></pre>
  39. </div>
  40. </div>