|
| 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; padding:0; |
| 11 | + text-align: center; |
| 12 | + } |
| 13 | + div, p, table, th, td { |
| 14 | + list-style:none; |
| 15 | + margin:0; padding:0; |
| 16 | + color:#333; font-size:12px; |
| 17 | + font-family:dotum, Verdana, Arial, Helvetica, AppleGothic, sans-serif; |
| 18 | + } |
| 19 | + #testIframe {margin-left: 10px;} |
| 20 | + </style> |
| 21 | +<script type="text/javascript" src="../../js/jquery-1.4.4.min.js"></script> |
| 22 | +<script type="text/javascript" src="../../js/jquery.ztree.core-3.5.js"></script> |
| 23 | + <SCRIPT type="text/javascript" > |
| 24 | + <!-- |
| 25 | + var zTree; |
| 26 | + var demoIframe; |
| 27 | + |
| 28 | + var setting = { |
| 29 | + view: { |
| 30 | + dblClickExpand: false, |
| 31 | + showLine: true, |
| 32 | + selectedMulti: false |
| 33 | + }, |
| 34 | + data: { |
| 35 | + simpleData: { |
| 36 | + enable:true, |
| 37 | + idKey: "id", |
| 38 | + pIdKey: "pId", |
| 39 | + rootPId: "" |
| 40 | + } |
| 41 | + }, |
| 42 | + callback: { |
| 43 | + beforeClick: function(treeId, treeNode) { |
| 44 | + var zTree = $.fn.zTree.getZTreeObj("tree"); |
| 45 | + if (treeNode.isParent) { |
| 46 | + zTree.expandNode(treeNode); |
| 47 | + return false; |
| 48 | + } else { |
| 49 | + demoIframe.attr("src",treeNode.file + ".html"); |
| 50 | + return true; |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | + }; |
| 55 | + |
| 56 | + var zNodes =[ |
| 57 | + {id:1, pId:0, name:"[core] 基本功能 演示", open:true}, |
| 58 | + {id:101, pId:1, name:"最简单的树 -- 标准 JSON 数据", file:"core/standardData"}, |
| 59 | + {id:102, pId:1, name:"最简单的树 -- 简单 JSON 数据", file:"core/simpleData"}, |
| 60 | + {id:103, pId:1, name:"不显示 连接线", file:"core/noline"}, |
| 61 | + {id:104, pId:1, name:"不显示 节点 图标", file:"core/noicon"}, |
| 62 | + {id:105, pId:1, name:"自定义图标 -- icon 属性", file:"core/custom_icon"}, |
| 63 | + {id:106, pId:1, name:"自定义图标 -- iconSkin 属性", file:"core/custom_iconSkin"}, |
| 64 | + {id:107, pId:1, name:"自定义字体", file:"core/custom_font"}, |
| 65 | + {id:115, pId:1, name:"超链接演示", file:"core/url"}, |
| 66 | + {id:108, pId:1, name:"异步加载 节点数据", file:"core/async"}, |
| 67 | + {id:109, pId:1, name:"用 zTree 方法 异步加载 节点数据", file:"core/async_fun"}, |
| 68 | + {id:110, pId:1, name:"用 zTree 方法 更新 节点数据", file:"core/update_fun"}, |
| 69 | + {id:111, pId:1, name:"单击 节点 控制", file:"core/click"}, |
| 70 | + {id:112, pId:1, name:"展开 / 折叠 父节点 控制", file:"core/expand"}, |
| 71 | + {id:113, pId:1, name:"根据 参数 查找 节点", file:"core/searchNodes"}, |
| 72 | + {id:114, pId:1, name:"其他 鼠标 事件监听", file:"core/otherMouse"}, |
| 73 | + |
| 74 | + {id:2, pId:0, name:"[excheck] 复/单选框功能 演示", open:false}, |
| 75 | + {id:201, pId:2, name:"Checkbox 勾选操作", file:"excheck/checkbox"}, |
| 76 | + {id:206, pId:2, name:"Checkbox nocheck 演示", file:"excheck/checkbox_nocheck"}, |
| 77 | + {id:207, pId:2, name:"Checkbox chkDisabled 演示", file:"excheck/checkbox_chkDisabled"}, |
| 78 | + {id:208, pId:2, name:"Checkbox halfCheck 演示", file:"excheck/checkbox_halfCheck"}, |
| 79 | + {id:202, pId:2, name:"Checkbox 勾选统计", file:"excheck/checkbox_count"}, |
| 80 | + {id:203, pId:2, name:"用 zTree 方法 勾选 Checkbox", file:"excheck/checkbox_fun"}, |
| 81 | + {id:204, pId:2, name:"Radio 勾选操作", file:"excheck/radio"}, |
| 82 | + {id:209, pId:2, name:"Radio nocheck 演示", file:"excheck/radio_nocheck"}, |
| 83 | + {id:210, pId:2, name:"Radio chkDisabled 演示", file:"excheck/radio_chkDisabled"}, |
| 84 | + {id:211, pId:2, name:"Radio halfCheck 演示", file:"excheck/radio_halfCheck"}, |
| 85 | + {id:205, pId:2, name:"用 zTree 方法 勾选 Radio", file:"excheck/radio_fun"}, |
| 86 | + |
| 87 | + {id:3, pId:0, name:"[exedit] 编辑功能 演示", open:false}, |
| 88 | + {id:301, pId:3, name:"拖拽 节点 基本控制", file:"exedit/drag"}, |
| 89 | + {id:302, pId:3, name:"拖拽 节点 高级控制", file:"exedit/drag_super"}, |
| 90 | + {id:303, pId:3, name:"用 zTree 方法 移动 / 复制 节点", file:"exedit/drag_fun"}, |
| 91 | + {id:304, pId:3, name:"基本 增 / 删 / 改 节点", file:"exedit/edit"}, |
| 92 | + {id:305, pId:3, name:"高级 增 / 删 / 改 节点", file:"exedit/edit_super"}, |
| 93 | + {id:306, pId:3, name:"用 zTree 方法 增 / 删 / 改 节点", file:"exedit/edit_fun"}, |
| 94 | + {id:307, pId:3, name:"异步加载 & 编辑功能 共存", file:"exedit/async_edit"}, |
| 95 | + {id:308, pId:3, name:"多棵树之间 的 数据交互", file:"exedit/multiTree"}, |
| 96 | + |
| 97 | + {id:4, pId:0, name:"大数据量 演示", open:false}, |
| 98 | + {id:401, pId:4, name:"一次性加载大数据量", file:"bigdata/common"}, |
| 99 | + {id:402, pId:4, name:"分批异步加载大数据量", file:"bigdata/diy_async"}, |
| 100 | + {id:403, pId:4, name:"分批异步加载大数据量", file:"bigdata/page"}, |
| 101 | + |
| 102 | + {id:5, pId:0, name:"组合功能 演示", open:false}, |
| 103 | + {id:501, pId:5, name:"冻结根节点", file:"super/oneroot"}, |
| 104 | + {id:502, pId:5, name:"单击展开/折叠节点", file:"super/oneclick"}, |
| 105 | + {id:503, pId:5, name:"保持展开单一路径", file:"super/singlepath"}, |
| 106 | + {id:504, pId:5, name:"添加 自定义控件", file:"super/diydom"}, |
| 107 | + {id:505, pId:5, name:"checkbox / radio 共存", file:"super/checkbox_radio"}, |
| 108 | + {id:506, pId:5, name:"左侧菜单", file:"super/left_menu"}, |
| 109 | + {id:513, pId:5, name:"OutLook 样式的左侧菜单", file:"super/left_menuForOutLook"}, |
| 110 | + {id:507, pId:5, name:"下拉菜单", file:"super/select_menu"}, |
| 111 | + {id:509, pId:5, name:"带 checkbox 的多选下拉菜单", file:"super/select_menu_checkbox"}, |
| 112 | + {id:510, pId:5, name:"带 radio 的单选下拉菜单", file:"super/select_menu_radio"}, |
| 113 | + {id:508, pId:5, name:"右键菜单 的 实现", file:"super/rightClickMenu"}, |
| 114 | + {id:511, pId:5, name:"与其他 DOM 拖拽互动", file:"super/dragWithOther"}, |
| 115 | + {id:512, pId:5, name:"异步加载模式下全部展开", file:"super/asyncForAll"}, |
| 116 | + |
| 117 | + {id:6, pId:0, name:"其他扩展功能 演示", open:false}, |
| 118 | + {id:601, pId:6, name:"隐藏普通节点", file:"exhide/common"}, |
| 119 | + {id:602, pId:6, name:"配合 checkbox 的隐藏", file:"exhide/checkbox"}, |
| 120 | + {id:603, pId:6, name:"配合 radio 的隐藏", file:"exhide/radio"} |
| 121 | + ]; |
| 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 | + }); |
| 132 | + |
| 133 | + function loadReady() { |
| 134 | + var bodyH = demoIframe.contents().find("body").get(0).scrollHeight, |
| 135 | + htmlH = demoIframe.contents().find("html").get(0).scrollHeight, |
| 136 | + maxH = Math.max(bodyH, htmlH), minH = Math.min(bodyH, htmlH), |
| 137 | + h = demoIframe.height() >= maxH ? minH:maxH ; |
| 138 | + if (h < 530) h = 530; |
| 139 | + demoIframe.height(h); |
| 140 | + } |
| 141 | + |
| 142 | + //--> |
| 143 | + </SCRIPT> |
| 144 | + </HEAD> |
| 145 | + |
| 146 | +<BODY> |
| 147 | +<TABLE border=0 height=600px align=left> |
| 148 | + <TR> |
| 149 | + <TD width=260px align=left valign=top style="BORDER-RIGHT: #999999 1px dashed"> |
| 150 | + <ul id="tree" class="ztree" style="width:260px; overflow:auto;"></ul> |
| 151 | + </TD> |
| 152 | + <TD width=770px align=left valign=top><IFRAME ID="testIframe" Name="testIframe" FRAMEBORDER=0 SCROLLING=AUTO width=100% height=600px SRC="core/standardData.html"></IFRAME></TD> |
| 153 | + </TR> |
| 154 | +</TABLE> |
| 155 | + |
| 156 | +</BODY> |
| 157 | +</HTML> |
0 commit comments