oneroot.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <TITLE> ZTREE DEMO - one root</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.min.js"></script>
  9. <!-- <script type="text/javascript" src="../../../js/jquery-1.4.4.min.js"></script>-->
  10. <script type="text/javascript" src="../../../js/jquery.ztree.core.js"></script>
  11. <!-- <script type="text/javascript" src="../../../js/jquery.ztree.excheck.js"></script>
  12. <script type="text/javascript" src="../../../js/jquery.ztree.exedit.js"></script>-->
  13. <SCRIPT type="text/javascript">
  14. <!--
  15. var setting = {
  16. view: {
  17. dblClickExpand: dblClickExpand
  18. },
  19. data: {
  20. simpleData: {
  21. enable: true
  22. }
  23. }
  24. };
  25. var zNodes =[
  26. { id:1, pId:0, name:"Root", open:true},
  27. { id:11, pId:1, name:"Parent Node 1-1", open:true},
  28. { id:111, pId:11, name:"Leaf Node 1-1-1"},
  29. { id:112, pId:11, name:"Leaf Node 1-1-2"},
  30. { id:113, pId:11, name:"Leaf Node 1-1-3"},
  31. { id:114, pId:11, name:"Leaf Node 1-1-4"},
  32. { id:12, pId:1, name:"Parent Node 1-2", open:true},
  33. { id:121, pId:12, name:"Leaf Node 1-2-1"},
  34. { id:122, pId:12, name:"Leaf Node 1-2-2"},
  35. { id:123, pId:12, name:"Leaf Node 1-2-3"},
  36. { id:124, pId:12, name:"Leaf Node 1-2-4"},
  37. { id:13, pId:1, name:"Parent Node 1-3", open:true},
  38. { id:131, pId:13, name:"Leaf Node 1-3-1"},
  39. { id:132, pId:13, name:"Leaf Node 1-3-2"},
  40. { id:133, pId:13, name:"Leaf Node 1-3-3"},
  41. { id:134, pId:13, name:"Leaf Node 1-3-4"}
  42. ];
  43. function dblClickExpand(treeId, treeNode) {
  44. return treeNode.level > 0;
  45. }
  46. $(document).ready(function(){
  47. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  48. });
  49. //-->
  50. </SCRIPT>
  51. <style type="text/css">
  52. .ztree li span.button.switch.level0 {visibility:hidden; width:1px;}
  53. .ztree li ul.level0 {padding:0; background:none;}
  54. </style>
  55. </HEAD>
  56. <BODY>
  57. <h1>Freeze the Root Node</h1>
  58. <h6>[ File Path: demo/super/oneroot.html ]</h6>
  59. <div class="content_wrap">
  60. <div class="zTreeDemoBackground left">
  61. <ul id="treeDemo" class="ztree"></ul>
  62. </div>
  63. <div class="right">
  64. <ul class="info">
  65. <li class="title"><h2>Explanation of implementation method</h2>
  66. <ul class="list">
  67. <li>For only one root, and do not show +/- switch needs need to modify the css, and set the setting.</li>
  68. <li class="highlight_red">zTree v3.x can be for a given level, set the style, check out the page source, see the css.</li>
  69. <li class="highlight_red">Set setting.view.dblClickExpand to Function, you can turn off double-clicking for expand the root node.</li>
  70. </ul>
  71. </li>
  72. </ul>
  73. </div>
  74. </div>
  75. </BODY>
  76. </HTML>