-
Notifications
You must be signed in to change notification settings - Fork 0
/
example8.html
54 lines (52 loc) · 1.73 KB
/
example8.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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<title>Styling Comboboxes [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({
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']
})
});
var combo = new Ext.form.ComboBox({
typeAhead: false,
forceSelection: true,
editable: false,
triggerAction: 'all',
mode: 'remote',
store: store,
valueField: 'id',
displayField: 'id',
listWidth: 300,
tpl: '<tpl for="."><div class="x-combo-list-item"><div class="image"><img src="{[values.user.profile_image_url]}"/></div><div class="name">{[values.user.screen_name]}</div><div class="text">{text:ellipsis(90, true)}</div></div></tpl>'
});
combo.render('content');
});
</script>
</head>
<body id="example8">
<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>Styling Comboboxes</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>