setting.edit.drag.inner.html 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Boolean / Function(treeId, treeNodes, targetNode)</span><span class="path">setting.edit.drag.</span>inner
  4. </h2>
  5. <h3>Overview<span class="h3_info">[ depends on <span
  6. class="highlight_green">jquery.ztree.exedit</span> js ]</span></h3>
  7. <div class="desc">
  8. <p></p>
  9. <div class="longdesc">
  10. <p>When drag one node to the target node, set whether to allow the node to be the target node's child.
  11. It is valid when <span class="highlight_red">[setting.edit.enable = true]</span></p>
  12. <p class="highlight_red">If the target node is root, so zTree will only trigger 'inner' and not trigger
  13. 'prev / next'.</p>
  14. <p class="highlight_red">This function mainly for the appropriate limit drag and drop (auxiliary arrow),
  15. it requires a combination of 'prev, next' together, to achieve full functionality.</p>
  16. <p>Default: true</p>
  17. </div>
  18. </div>
  19. <h3>Boolean Format</h3>
  20. <div class="desc">
  21. <p> true means: allow the node to be the target node's child.</p>
  22. <p> false means: don't allow the node to be the target node's child.</p>
  23. </div>
  24. <h3>Function Parameter Descriptions</h3>
  25. <div class="desc">
  26. <h4><b>treeId</b><span>String</span></h4>
  27. <p>zTree unique identifier: <b class="highlight_red">treeId</b>.</p>
  28. <h4 class="topLine"><b>treeNodes</b><span>Array(JSON)</span></h4>
  29. <p>A collection of the nodes which has been dragged</p>
  30. <h4 class="topLine"><b>targetNode</b><span>JSON</span></h4>
  31. <p>JSON data object of the target node which treeNodes are draged over.</p>
  32. <p class="highlight_red">If the treeNodes will be root node, the targetNode = null</p>
  33. <h4 class="topLine"><b>Return </b><span>Boolean</span></h4>
  34. <p>return true or false</p>
  35. </div>
  36. <h3>Examples of setting & function</h3>
  37. <h4>1. disable to drag the node to the target node's inner.</h4>
  38. <pre xmlns=""><code>var setting = {
  39. edit: {
  40. enable: true,
  41. drag: {
  42. prev: true,
  43. next: true,
  44. inner: false
  45. }
  46. }
  47. };
  48. ......</code></pre>
  49. <h4>2. disable to drag the node to be root node's child.</h4>
  50. <pre xmlns=""><code>function canInner(treeId, nodes, targetNode) {
  51. return !(targetNode && targetNode.level === 0);
  52. }
  53. var setting = {
  54. edit: {
  55. enable: true,
  56. drag: {
  57. prev: true,
  58. next: true,
  59. inner: canInner
  60. }
  61. }
  62. };
  63. ......</code></pre>
  64. </div>
  65. </div>