-
Notifications
You must be signed in to change notification settings - Fork 90
/
tuto5c.html
55 lines (54 loc) · 1006 Bytes
/
tuto5c.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
<html>
<head>
<title>PURE Unobtrusive Rendering Engine</title>
<script src="../libs/jquery.js"></script>
<script src="../libs/pure.js"></script>
</head>
<body>
<table>
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
<script>
var cols = ['name', 'food', 'legs', 'button'],
data = {animals:[
{name:'bird', food:'seed', legs:2},
{name:'cat', food:'mouse, bird', legs:4},
{name:'dog', food:'bone', legs:4},
{name:'mouse', food:'cheese', legs:4}
]
},
colsDir = {
'th':{
'col<-':{
'.':'col'
}
},
'td':{
'col<-':{
'@class':'col'
}
}
},
dataDir = {
'tbody tr':{
'animal<-animals':{
'td.name':'animal.name',
'td.food':'animal.food',
'td.legs':'animal.legs',
'td.button':'<button onclick="alert(#{animal.legs})">View</button>'
}
}
};
$('table').render(cols, colsDir).render(data, dataDir);
</script>
</body>
</html>