oneroot.html 2.7 KB

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