index.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <HTML>
  3. <HEAD>
  4. <TITLE> ZTREE DEMO </TITLE>
  5. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  6. <link rel="stylesheet" href="../../css/zTreeStyle/zTreeStyle.css" type="text/css">
  7. <style>
  8. body {
  9. background-color: white;
  10. margin: 0;
  11. padding: 0;
  12. text-align: center;
  13. }
  14. div, p, table, th, td {
  15. list-style: none;
  16. margin: 0;
  17. padding: 0;
  18. color: #333;
  19. font-size: 12px;
  20. font-family: dotum, Verdana, Arial, Helvetica, AppleGothic, sans-serif;
  21. }
  22. #testIframe {
  23. margin-left: 10px;
  24. }
  25. </style>
  26. <script type="text/javascript" src="../../js/jquery-1.4.4.min.js"></script>
  27. <script type="text/javascript" src="../../js/jquery.ztree.core.js"></script>
  28. <SCRIPT type="text/javascript">
  29. <!--
  30. var zTree;
  31. var demoIframe;
  32. var setting = {
  33. view: {
  34. dblClickExpand: false,
  35. showLine: true,
  36. selectedMulti: false
  37. },
  38. data: {
  39. simpleData: {
  40. enable: true,
  41. idKey: "id",
  42. pIdKey: "pId",
  43. rootPId: ""
  44. }
  45. },
  46. callback: {
  47. beforeClick: function (treeId, treeNode) {
  48. var zTree = $.fn.zTree.getZTreeObj("tree");
  49. if (treeNode.isParent) {
  50. zTree.expandNode(treeNode);
  51. return false;
  52. } else {
  53. demoIframe.attr("src", treeNode.file + ".html");
  54. return true;
  55. }
  56. }
  57. }
  58. };
  59. var zNodes = [
  60. {id: 1, pId: 0, name: "[core] Basic Functions", open: false},
  61. {id: 101, pId: 1, name: "Standard JSON Data", file: "core/standardData"},
  62. {id: 102, pId: 1, name: "Simple JSON Data", file: "core/simpleData"},
  63. {id: 103, pId: 1, name: "Don't Show Line", file: "core/noline"},
  64. {id: 104, pId: 1, name: "Don't Show Icon", file: "core/noicon"},
  65. {id: 105, pId: 1, name: "Custom Icon - icon", file: "core/custom_icon"},
  66. {id: 106, pId: 1, name: "Custom Icon - iconSkin", file: "core/custom_iconSkin"},
  67. {id: 107, pId: 1, name: "Custom Fonts", file: "core/custom_font"},
  68. {id: 115, pId: 1, name: "Hyperlinks Demo", file: "core/url"},
  69. {id: 108, pId: 1, name: "Dynamic Tree with Ajax", file: "core/async"},
  70. {id: 109, pId: 1, name: "Dynamic Tree - zTree methods", file: "core/async_fun"},
  71. {id: 110, pId: 1, name: "Update Node - zTree methods", file: "core/update_fun"},
  72. {id: 111, pId: 1, name: "Control of Click Node", file: "core/click"},
  73. {id: 112, pId: 1, name: "Control of Expand Node", file: "core/expand"},
  74. {id: 113, pId: 1, name: "Search Nodes", file: "core/searchNodes"},
  75. {id: 114, pId: 1, name: "Other Mouse Events for zTree", file: "core/otherMouse"},
  76. {id: 2, pId: 0, name: "[excheck] Checkbox & Radio", open: false},
  77. {id: 201, pId: 2, name: "Checkbox Operation", file: "excheck/checkbox"},
  78. {id: 206, pId: 2, name: "Checkbox nocheck Demo", file: "excheck/checkbox_nocheck"},
  79. {id: 207, pId: 2, name: "Checkbox chkDisabled Demo", file: "excheck/checkbox_chkDisabled"},
  80. {id: 208, pId: 2, name: "Checkbox halfCheck Demo", file: "excheck/checkbox_halfCheck"},
  81. {id: 202, pId: 2, name: "Statistics Checkbox is Checked", file: "excheck/checkbox_count"},
  82. {id: 203, pId: 2, name: "Checkbox - zTree methods", file: "excheck/checkbox_fun"},
  83. {id: 204, pId: 2, name: "Radio Operation", file: "excheck/radio"},
  84. {id: 209, pId: 2, name: "Radio nocheck Demo", file: "excheck/radio_nocheck"},
  85. {id: 210, pId: 2, name: "Radio chkDisabled Demo", file: "excheck/radio_chkDisabled"},
  86. {id: 211, pId: 2, name: "Radio halfCheck Demo", file: "excheck/radio_halfCheck"},
  87. {id: 205, pId: 2, name: "Radio - zTree methods", file: "excheck/radio_fun"},
  88. {id: 3, pId: 0, name: "[exedit] Editing", open: false},
  89. {id: 301, pId: 3, name: "Normal Drag Node Operation", file: "exedit/drag"},
  90. {id: 302, pId: 3, name: "Advanced Drag Node Operation", file: "exedit/drag_super"},
  91. {id: 303, pId: 3, name: "Move / Copy - zTree methods", file: "exedit/drag_fun"},
  92. {id: 304, pId: 3, name: "Basic Edit Nodes", file: "exedit/edit"},
  93. {id: 305, pId: 3, name: "Advanced Edit Nodes", file: "exedit/edit_super"},
  94. {id: 306, pId: 3, name: "Edit Nodes - zTree methods", file: "exedit/edit_fun"},
  95. {id: 307, pId: 3, name: "Editing Dynamic Tree", file: "exedit/async_edit"},
  96. {id: 308, pId: 3, name: "Multiple Trees", file: "exedit/multiTree"},
  97. {id: 4, pId: 0, name: "Large Amount of Data Loading", open: false},
  98. {id: 401, pId: 4, name: "One-time Large Data Loading", file: "bigdata/common"},
  99. {id: 402, pId: 4, name: "Loading Data in Batches", file: "bigdata/diy_async"},
  100. {id: 403, pId: 4, name: "Loading Data By Pagination", file: "bigdata/page"},
  101. {id: 5, pId: 0, name: "Multi-functional", open: false},
  102. {id: 501, pId: 5, name: "Freeze the Root Node", file: "super/oneroot"},
  103. {id: 502, pId: 5, name: "Click to Expand Node", file: "super/oneclick"},
  104. {id: 503, pId: 5, name: "Keep Single Path", file: "super/singlepath"},
  105. {id: 516, pId: 5, name: "Fuzzy Search", file: "super/fuzzySearch"},
  106. {id: 504, pId: 5, name: "Adding Custom DOM", file: "super/diydom"},
  107. {id: 505, pId: 5, name: "Checkbox / Radio Coexistence", file: "super/checkbox_radio"},
  108. {id: 506, pId: 5, name: "Left Menu", file: "super/left_menu"},
  109. {id: 513, pId: 5, name: "OutLook Style", file: "super/left_menuForOutLook"},
  110. {id: 515, pId: 5, name: "Awesome Style", file: "super/awesome"},
  111. {id: 514, pId: 5, name: "Metro Style", file: "super/metro"},
  112. {id: 507, pId: 5, name: "Drop-down Menu", file: "super/select_menu"},
  113. {id: 509, pId: 5, name: "Drop-down Menu with checkbox", file: "super/select_menu_checkbox"},
  114. {id: 510, pId: 5, name: "Drop-down Menu with radio", file: "super/select_menu_radio"},
  115. {id: 508, pId: 5, name: "Right-click Menu", file: "super/rightClickMenu"},
  116. {id: 511, pId: 5, name: "Drag With Other DOMs", file: "super/dragWithOther"},
  117. {id: 512, pId: 5, name: "Expand All Nodes with Async", file: "super/asyncForAll"},
  118. {id: 6, pId: 0, name: "Other Extension Package", open: false},
  119. {id: 601, pId: 6, name: "hide ordinary node", file: "exhide/common"},
  120. {id: 602, pId: 6, name: "hide with checkbox mode", file: "exhide/checkbox"},
  121. {id: 603, pId: 6, name: "hide with radio mode", file: "exhide/radio"}
  122. ];
  123. $(document).ready(function () {
  124. var t = $("#tree");
  125. t = $.fn.zTree.init(t, setting, zNodes);
  126. demoIframe = $("#testIframe");
  127. demoIframe.bind("load", loadReady);
  128. var zTree = $.fn.zTree.getZTreeObj("tree");
  129. zTree.selectNode(zTree.getNodeByParam("id", 101));
  130. });
  131. function loadReady() {
  132. var bodyH = demoIframe.contents().find("body").get(0).scrollHeight,
  133. htmlH = demoIframe.contents().find("html").get(0).scrollHeight,
  134. maxH = Math.max(bodyH, htmlH), minH = Math.min(bodyH, htmlH),
  135. h = demoIframe.height() >= maxH ? minH : maxH;
  136. if (h < 530) h = 530;
  137. demoIframe.height(h);
  138. }
  139. //-->
  140. </SCRIPT>
  141. </HEAD>
  142. <BODY>
  143. <TABLE border=0 height=600px align=left>
  144. <TR>
  145. <TD width=260px align=left valign=top style="BORDER-RIGHT: #999999 1px dashed">
  146. <ul id="tree" class="ztree" style="width:260px; overflow:auto;"></ul>
  147. </TD>
  148. <TD width=770px align=left valign=top>
  149. <IFRAME ID="testIframe" Name="testIframe" FRAMEBORDER=0 SCROLLING=AUTO width=100% height=600px
  150. SRC="core/standardData.html"></IFRAME>
  151. </TD>
  152. </TR>
  153. </TABLE>
  154. </BODY>
  155. </HTML>