-
Notifications
You must be signed in to change notification settings - Fork 0
/
example11.html
73 lines (72 loc) · 1.99 KB
/
example11.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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<title>Templates in the data grid< [Ext JS Templating Magic]</title>
<script src="ext-3.3.1/adapter/ext/ext-base.js"></script>
<script src="ext-3.3.1/ext-all.js"></script>
<script src="examples.js"></script>
<link rel="stylesheet" type="text/css" href="ext-3.3.1/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="examples.css" />
<script>
Ext.onReady(function() {
// load the Twitter public timeline
var store = new Ext.data.Store({
autoLoad: true,
proxy: new Ext.data.ScriptTagProxy({
url: 'http://api.twitter.com/1/statuses/public_timeline.json?include_entities=true',
callbackParam: 'callback'
}),
reader: new Ext.data.JsonReader({
idProperty: 'id',
fields: ['id', 'text', 'user', 'source', {name: 'created_at', type: 'date'}]
})
});
var grid = new Ext.grid.GridPanel({
store: store,
autoHeight: true,
loadMask: true,
autoExpandColumn: 'col-text',
columns: [{
header: ' ',
xtype: 'templatecolumn',
tpl: '<img src="{[values.user.profile_image_url]}"/>',
width: 55
}, {
header: 'Screen Name',
xtype: 'templatecolumn',
tpl: '<b>{[values.user.screen_name]}</b>',
width: 120
}, {
header: 'Date',
dataIndex: 'created_at',
xtype: 'datecolumn',
format: 'l, F d, Y g:i:s A',
width: 220
}, {
header: 'Tweet',
dataIndex: 'text',
id: 'col-text'
}, {
header: 'Source',
dataIndex: 'source',
width: 120
}]
});
grid.render('content');
});
</script>
</head>
<body id="example11">
<ul id="page-nav">
<li><a rel="index" href="#">index</a></li>
<li><a rel="prev" href="#">←</a></li>
<li><a rel="next" href="#">→</a></li>
</ul>
<h1><a rel="source" href="#">view source</a>Templates in the data grid</h1>
<div id="content"></div>
<div id="footer">
Stefan Gehrig, 2011, to accompany the article "Ext JS templating magic" in <a href="http://jsmag.com"><jsmag></a> 05/2011
</div>
</body>
</html>