-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
123 lines (123 loc) · 3.95 KB
/
demo.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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery表格展开折叠,默认折叠</title>
<link rel="stylesheet" href="TableTree.css">
<style>
table{ border:0;border-collapse:collapse;}
th{ font:bold 12px/17px Arial;text-align:left;padding:4px;border-bottom:1px solid #333;width:150px;}
</style>
</head>
<body>
<table id="tableTree" class="tableTree">
<thead>
<tr><th>名称</th><th>代码</th><th>类型</th><th>状态</th></tr>
</thead>
<tbody>
</tbody>
</table>
<script src="jquery.js"></script>
<script src="TableTree.js"></script>
<script>
var data = [{
'id': 'id1',
'pid': '0',
'isParent': true,
'attr': {
'code': '123',
'name': '总经销商',
'type': '总经销商',
'status': '激活'
},
'children': [{
'id': 'id3',
'pid': 'id1',
'isParent': false,
'attr': {
'code': '123',
'name': '一级经销商',
'type': '分销商',
'status': '激活'
},
'children': []
}, {
'id': 'id4',
'pid': 'id1',
'isParent': true,
'attr': {
'code': '123',
'name': '一级经销商',
'type': '分销商',
'status': '激活'
},
'children': [{
'id': 'id5',
'pid': 'id4',
'isParent': true,
'attr': {
'code': '123',
'name': '二级经销商',
'type': '分销商',
'status': '激活'
},
'children': [{
'id': 'id7',
'pid': 'id5',
'isParent': false,
'attr': {
'code': '123',
'name': '三级经销商',
'type': '分销商',
'status': '激活'
},
'children': []
}, {
'id': 'id8',
'pid': 'id5',
'isParent': false,
'attr': {
'code': '123',
'name': '三级经销商',
'type': '分销商',
'status': '激活'
},
'children': []
}]
}, {
'id': 'id6',
'pid': 'id4',
'isParent': false,
'attr': {
'code': '123',
'name': '二级经销商',
'type': '分销商',
'status': '激活'
},
'children': []
}]
}]
}, {
'id': 'id2',
'pid': '0',
'isParent': false,
'attr': {
'code': '123',
'name': '总经销商',
'type': '总经销商',
'status': '激活'
},
'children': []
}];
$(function(){
window.tt = new CheckBoxTableTree({
'tableArea' : $('#tableTree'),
//'ajaxURL' : 'table.html',
'thKey' : ['name', 'code', 'type', 'status'],
'data' : data
});
tt.init();
});
</script>
</body>
</html>