Revision 5c7a7910bf4c () - Diff

Link to this snippet: https://friendpaste.com/3XOuUq1pXFNG6No8OzHjEX
Embed:
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Chain.js Example 3</title>
<script src="../lib/jquery-1.2.6.pack.js" language="javascript"></script>
<script src="../build/chain.js" language="javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#tables').chain(function(){
var self = this;
var tbody = self.find('tbody');
tbody.chain();
self.update(function(){
var data = self.item();
tbody.items('replace', data.rows);
});
});
$('#tables').items([
{level:"Level1", head1:"Col1", head2:"Col2", head3:"Col3", rows:[
{col1:"Some Data", col2:"A", col3:"B"},
{col1:"Some Data", col2:"A", col3:"B"},
{col1:"Some Data", col2:"A", col3:"B"}
]},
{level:"Level2", head1:"Col1", head2:"Col2", head3:"Col3", rows:[
{col1:"Some Data", col2:"A", col3:"B"},
{col1:"Some Data", col2:"A", col3:"B"},
{col1:"Some Data", col2:"A", col3:"B"}
]},
{level:"level3", head1:"Col1", head2:"Col2", head3:"Col3", rows:[
{col1:"Some Data", col2:"A", col3:"B"},
{col1:"Some Data", col2:"A", col3:"B"},
{col1:"Some Data", col2:"A", col3:"B"}
]}
]);
});
</script>
</head>
<body>
<div id="tables">
<table>
<thead>
<tr><th class="level" colspan="3">Level</th></tr>
<tr>
<th class="head1">Col1</th>
<th class="head2">Col2</th>
<th class="head3">Col3</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">some data</td>
<td class="col2">A</td>
<td class="col3">B</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>