setting.edit.drag.prev.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Boolean / Function(treeId, treeNodes, targetNode)</span><span class="path">setting.edit.drag.</span>prev
  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 previous
  11. sibling. 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 'next, inner' 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 previous sibling.</p>
  22. <p> false means: don't allow the node to be the target node's previous sibling.</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. <h4 class="topLine"><b>Return </b><span>Boolean</span></h4>
  33. <p>return true or false</p>
  34. </div>
  35. <h3>Examples of setting & function</h3>
  36. <h4>1. disable to drag the node to the target node's previous sibling.</h4>
  37. <pre xmlns=""><code>var setting = {
  38. edit: {
  39. enable: true,
  40. drag: {
  41. prev: false,
  42. next: true,
  43. inner: true
  44. }
  45. }
  46. };
  47. ......</code></pre>
  48. <h4>2. disable to drag the node to be all of the parent nodes's previous sibling.</h4>
  49. <pre xmlns=""><code>function canPrev(treeId, nodes, targetNode) {
  50. return !targetNode.isParent;
  51. }
  52. var setting = {
  53. edit: {
  54. enable: true,
  55. drag: {
  56. prev: canPrev,
  57. next: true,
  58. inner: true
  59. }
  60. }
  61. };
  62. ......</code></pre>
  63. </div>
  64. </div>