forked from lisztj/ZTREE-BOOTSTRAP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
304 lines (291 loc) · 8.93 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE> ZTREE DEMO - Simple Data</TITLE>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/bootstrapStyle/bootstrapStyle.css" type="text/css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.ztree.core.js"></script>
<script type="text/javascript" src="js/jquery.ztree.excheck.js"></script>
<script type="text/javascript" src="js/jquery.ztree.exedit.js"></script>
<SCRIPT type="text/javascript">
var setting = {
view: {
addHoverDom: addHoverDom,
removeHoverDom: removeHoverDom,
selectedMulti: false
},
check: {
enable: true
},
data: {
simpleData: {
enable: true
}
},
edit: {
enable: true
}
};
var zNodes = [{
id: 1,
pId: 0,
name: "[core] 基本功能 演示",
open: true,
tag: 11
}, {
id: 101,
pId: 1,
name: "最简单的树 -- 标准 JSON 数据"
}, {
id: 102,
pId: 1,
name: "最简单的树 -- 简单 JSON 数据"
}, {
id: 103,
pId: 1,
name: "不显示 连接线"
}, {
id: 104,
pId: 1,
name: "不显示 节点 图标"
}, {
id: 108,
pId: 1,
name: "异步加载 节点数据"
}, {
id: 109,
pId: 1,
name: "用 zTree 方法 异步加载 节点数据"
}, {
id: 110,
pId: 1,
name: "用 zTree 方法 更新 节点数据"
}, {
id: 111,
pId: 1,
name: "单击 节点 控制"
}, {
id: 112,
pId: 1,
name: "展开 / 折叠 父节点 控制"
}, {
id: 113,
pId: 1,
name: "根据 参数 查找 节点"
}, {
id: 114,
pId: 1,
name: "其他 鼠标 事件监听"
},
{
id: 2,
pId: 0,
name: "[excheck] 复/单选框功能 演示",
open: false
}, {
id: 201,
pId: 2,
name: "Checkbox 勾选操作"
}, {
id: 206,
pId: 2,
name: "Checkbox nocheck 演示"
}, {
id: 207,
pId: 2,
name: "Checkbox chkDisabled 演示"
}, {
id: 208,
pId: 2,
name: "Checkbox halfCheck 演示"
}, {
id: 202,
pId: 2,
name: "Checkbox 勾选统计"
}, {
id: 203,
pId: 2,
name: "用 zTree 方法 勾选 Checkbox"
}, {
id: 204,
pId: 2,
name: "Radio 勾选操作"
}, {
id: 209,
pId: 2,
name: "Radio nocheck 演示"
}, {
id: 210,
pId: 2,
name: "Radio chkDisabled 演示"
}, {
id: 211,
pId: 2,
name: "Radio halfCheck 演示"
}, {
id: 205,
pId: 2,
name: "用 zTree 方法 勾选 Radio"
},
{
id: 3,
pId: 0,
name: "[exedit] 编辑功能 演示",
open: false
}, {
id: 301,
pId: 3,
name: "拖拽 节点 基本控制"
}, {
id: 302,
pId: 3,
name: "拖拽 节点 高级控制"
}, {
id: 303,
pId: 3,
name: "用 zTree 方法 移动 / 复制 节点"
}, {
id: 304,
pId: 3,
name: "基本 增 / 删 / 改 节点"
}, {
id: 305,
pId: 3,
name: "高级 增 / 删 / 改 节点"
}, {
id: 306,
pId: 3,
name: "用 zTree 方法 增 / 删 / 改 节点"
}, {
id: 307,
pId: 3,
name: "异步加载 & 编辑功能 共存"
}, {
id: 308,
pId: 3,
name: "多棵树之间 的 数据交互"
},
{
id: 4,
pId: 0,
name: "大数据量 演示",
open: false
}, {
id: 401,
pId: 4,
name: "一次性加载大数据量"
}, {
id: 402,
pId: 4,
name: "分批异步加载大数据量"
}, {
id: 403,
pId: 4,
name: "分批异步加载大数据量"
},
{
id: 5,
pId: 0,
name: "组合功能 演示",
open: false
}, {
id: 501,
pId: 5,
name: "冻结根节点"
}, {
id: 502,
pId: 5,
name: "单击展开/折叠节点"
}, {
id: 503,
pId: 5,
name: "保持展开单一路径"
}, {
id: 504,
pId: 5,
name: "添加 自定义控件"
}, {
id: 505,
pId: 5,
name: "checkbox / radio 共存"
}, {
id: 506,
pId: 5,
name: "左侧菜单"
}, {
id: 507,
pId: 5,
name: "下拉菜单"
}, {
id: 509,
pId: 5,
name: "带 checkbox 的多选下拉菜单"
}, {
id: 510,
pId: 5,
name: "带 radio 的单选下拉菜单"
}, {
id: 508,
pId: 5,
name: "右键菜单 的 实现"
}, {
id: 511,
pId: 5,
name: "与其他 DOM 拖拽互动"
}, {
id: 512,
pId: 5,
name: "异步加载模式下全部展开"
},
{
id: 6,
pId: 0,
name: "其他扩展功能 演示",
open: false
}, {
id: 601,
pId: 6,
name: "隐藏普通节点"
}, {
id: 602,
pId: 6,
name: "配合 checkbox 的隐藏"
}, {
id: 603,
pId: 6,
name: "配合 radio 的隐藏"
}
];
$(document).ready(function() {
$.fn.zTree.init($("#treeDemo"), setting, zNodes);
});
var newCount = 1;
function addHoverDom(treeId, treeNode) {
var sObj = $("#" + treeNode.tId + "_span");
if (treeNode.editNameFlag || $("#addBtn_" + treeNode.tId).length > 0) return;
var addStr = "<span class='button add' id='addBtn_" + treeNode.tId +
"' title='add node' onfocus='this.blur();'></span>";
sObj.after(addStr);
var btn = $("#addBtn_" + treeNode.tId);
if (btn) btn.bind("click", function() {
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
zTree.addNodes(treeNode, {
id: (100 + newCount),
pId: treeNode.id,
name: "new node" + (newCount++)
});
return false;
});
};
function removeHoverDom(treeId, treeNode) {
$("#addBtn_" + treeNode.tId).unbind().remove();
};
//-->
</SCRIPT>
</HEAD>
<BODY>
<h1>zTree - bootstrap 风格</h1>
<ul id="treeDemo" class="ztree"></ul>
</BODY>
</HTML>