-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
158 lines (155 loc) · 4.28 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="dist/jquery-simple-tree-table.js"></script>
</head>
<body>
<h1>Basic Table</h1>
<button type="button" id="expander">expand</button>
<button type="button" id="collapser">collapse</button>
<button type="button" id="open1">open 1</button>
<button type="button" id="close1">close 1</button>
<table id="basic" border="1">
<tr data-node-id="1">
<td><a href="#">1</a></td>
<td>text of 1</td>
</tr>
<tr data-node-id="1.1" data-node-pid="1">
<td><a href="#">1.1</a></td>
<td>text of 1.1</td>
</tr>
<tr data-node-id="1.1.1" data-node-pid="1.1">
<td><a href="#">1.1.1</a></td>
<td>text of 1.1.1</td>
</tr>
<tr data-node-id="1.1.2" data-node-pid="1.1">
<td><a href="#">1.1.2</a></td>
<td>text of 1.1.2</td>
</tr>
<tr data-node-id="1.2" data-node-pid="1">
<td><a href="#">1.2</a></td>
<td>text of 1.2</td>
</tr>
<tr data-node-id="1.2.1" data-node-pid="1.2">
<td><a href="#">1.2.1</a></td>
<td>text of 1.2.1</td>
</tr>
<tr data-node-id="1.2.2" data-node-pid="1.2">
<td><a href="#">1.2.2</a></td>
<td>text of 1.2.2</td>
</tr>
<tr data-node-id="2">
<td><a href="#">2</a></td>
<td>text of 2</td>
</tr>
<tr data-node-id="2.1" data-node-pid="2">
<td><a href="#">2.1</a></td>
<td>text of 2.1</td>
</tr>
<tr data-node-id="2.2" data-node-pid="2">
<td><a href="#">2.2</a></td>
<td>text of 2.2</td>
</tr>
</table>
<script>
$('#basic').simpleTreeTable({
expander: $('#expander'),
collapser: $('#collapser'),
store: 'session',
storeKey: 'simple-tree-table-basic'
});
$('#open1').on('click', function() {
$('#basic').data('simple-tree-table').openByID("1");
});
$('#close1').on('click', function() {
$('#basic').data('simple-tree-table').closeByID("1");
});
</script>
<h1>Specify opened nodes</h1>
<table id="opened" border="1">
<tr data-node-id="1">
<td>1</td>
<td>text of 1</td>
</tr>
<tr data-node-id="1.1" data-node-pid="1">
<td>1.1</td>
<td>text of 1.1</td>
</tr>
<tr data-node-id="1.1.1" data-node-pid="1.1">
<td>1.1.1</td>
<td>text of 1.1.1</td>
</tr>
<tr data-node-id="1.1.1.1" data-node-pid="1.1.1">
<td>1.1.1.1</td>
<td>text of 1.1.1.1</td>
</tr>
<tr data-node-id="1.2" data-node-pid="1">
<td>1.2</td>
<td>text of 1.2</td>
</tr>
<tr data-node-id="1.2.1" data-node-pid="1.2">
<td>1.2.1</td>
<td>text of 1.2.1</td>
</tr>
<tr data-node-id="1.2.1.1" data-node-pid="1.2.1">
<td>1.2.1.1</td>
<td>text of 1.2.1.1</td>
</tr>
</table>
<script>
$('#opened').simpleTreeTable({
opened: [1, 1.1]
});
</script>
<h1>Callback</h1>
<table id="callback" border="1">
<tr data-node-id="1">
<td>1</td>
<td>text of 1</td>
</tr>
<tr data-node-id="1.1" data-node-pid="1">
<td>1.1</td>
<td>text of 1.1</td>
</tr>
<tr data-node-id="1.1.1" data-node-pid="1.1">
<td>1.1.1</td>
<td>text of 1.1.1</td>
</tr>
<tr data-node-id="1.2" data-node-pid="1">
<td>1.2</td>
<td>text of 1.2</td>
</tr>
</table>
<p id="message"> </p>
<script>
$('#callback').simpleTreeTable({
}).on('node:open', function(e, $node) {
$('#message').append("opened " + $node.data('node-id') + " ");
}).on('node:close', function(e, $node) {
$('#message').append("closed " + $node.data('node-id') + " ");
});
</script>
<h1>Change icon position</h1>
<table id="icon_pos" border="1">
<tr data-node-id="1">
<td>1</td>
<td><span>text of 1</span></td>
</tr>
<tr data-node-id="1.1" data-node-pid="1">
<td>1.1</td>
<td><span>text of 1.1</span></td>
</tr>
<tr data-node-id="1.1.1" data-node-pid="1.1">
<td>1.1.1</td>
<td><span>text of 1.1.1</span></td>
</tr>
</table>
<script>
$('#icon_pos').simpleTreeTable({
iconPosition: 'td:last-child > span'
});
</script>
</body>
</html>