multiTree.html 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <TITLE> ZTREE DEMO - multiTree</TITLE>
  5. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  6. <link rel="stylesheet" href="../../../css/demo.css" type="text/css">
  7. <link rel="stylesheet" href="../../../css/zTreeStyle/zTreeStyle.css" type="text/css">
  8. <script type="text/javascript" src="../../../js/jquery-1.4.4.min.js"></script>
  9. <script type="text/javascript" src="../../../js/jquery.ztree.core-3.5.js"></script>
  10. <script type="text/javascript" src="../../../js/jquery.ztree.excheck-3.5.js"></script>
  11. <script type="text/javascript" src="../../../js/jquery.ztree.exedit-3.5.js"></script>
  12. <SCRIPT type="text/javascript">
  13. <!--
  14. var setting = {
  15. edit: {
  16. enable: true,
  17. showRemoveBtn: false,
  18. showRenameBtn: false
  19. },
  20. data: {
  21. simpleData: {
  22. enable: true
  23. }
  24. },
  25. callback: {
  26. beforeDrag: beforeDrag,
  27. beforeDrop: beforeDrop
  28. }
  29. };
  30. var zNodes =[
  31. { id:1, pId:0, name:"父节点 1", open:true},
  32. { id:11, pId:1, name:"叶子节点 1-1"},
  33. { id:12, pId:1, name:"叶子节点 1-2"},
  34. { id:13, pId:1, name:"叶子节点 1-3"},
  35. { id:2, pId:0, name:"父节点 2", open:true},
  36. { id:21, pId:2, name:"叶子节点 2-1"},
  37. { id:22, pId:2, name:"叶子节点 2-2"},
  38. { id:23, pId:2, name:"叶子节点 2-3"},
  39. { id:3, pId:0, name:"父节点 3", open:true},
  40. { id:31, pId:3, name:"叶子节点 3-1"},
  41. { id:32, pId:3, name:"叶子节点 3-2"},
  42. { id:33, pId:3, name:"叶子节点 3-3"}
  43. ];
  44. function beforeDrag(treeId, treeNodes) {
  45. for (var i=0,l=treeNodes.length; i<l; i++) {
  46. if (treeNodes[i].drag === false) {
  47. return false;
  48. }
  49. }
  50. return true;
  51. }
  52. function beforeDrop(treeId, treeNodes, targetNode, moveType) {
  53. return targetNode ? targetNode.drop !== false : true;
  54. }
  55. $(document).ready(function(){
  56. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  57. $.fn.zTree.init($("#treeDemo2"), setting);
  58. });
  59. //-->
  60. </SCRIPT>
  61. </HEAD>
  62. <BODY>
  63. <h1>多棵树之间 的 数据交互</h1>
  64. <h6>[ 文件路径: exedit/multiTree.html ]</h6>
  65. <div class="content_wrap">
  66. <div>
  67. <ul class="info">
  68. <li class="title"><h2>1、setting 配置信息说明</h2>
  69. <ul class="list">
  70. <li>zTree 对于多棵树之间拖拽的操作非常简单,只需要创建两棵可拖拽的树即可,同时可根据 各种事件回调函数 以及 zTree 的方法配合实现较复杂的操作规则,这里只是基本演示。</li>
  71. <li class="highlight_red">关于配置信息请参考拖拽、编辑等 Demo 的详细说明</li>
  72. </ul>
  73. </li>
  74. <li class="title"><h2>2、treeNode 节点数据说明</h2>
  75. <ul class="list">
  76. <li>对 节点数据 没有特殊要求,用户可以根据自己的需求添加自定义属性</li>
  77. </ul>
  78. </li>
  79. </ul>
  80. </div>
  81. <div class="zTreeDemoBackground left">
  82. <ul id="treeDemo" class="ztree"></ul>
  83. </div>
  84. <div class="right">
  85. <ul id="treeDemo2" class="ztree"></ul>
  86. </div>
  87. </div>
  88. </BODY>
  89. </HTML>