IconBrowser.js
1.54 KB
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
/**
* @class Ext.chooser.IconBrowser
* @extends Ext.view.View
* @author Ed Spencer
*
* This is a really basic subclass of Ext.view.View. All we're really doing here is providing the template that dataview
* should use (the tpl property below), and a Store to get the data from. In this case we're loading data from a JSON
* file over AJAX.
*/
Ext.define('Ext.chooser.IconBrowser', {
extend: 'Ext.view.View',
alias: 'widget.iconbrowser',
uses: 'Ext.data.Store',
singleSelect: true,
overItemCls: 'x-view-over',
itemSelector: 'div.thumb-wrap',
tpl: [
// '<div class="details">',
'<tpl for=".">',
'<div class="thumb-wrap">',
'<div class="thumb">',
(!Ext.isIE6? '<img src="icons/{thumb}" />' :
'<div style="width:74px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'icons/{thumb}\')"></div>'),
'</div>',
'<span>{name}</span>',
'</div>',
'</tpl>'
// '</div>'
],
initComponent: function() {
this.store = Ext.create('Ext.data.Store', {
autoLoad: true,
fields: ['name', 'thumb', 'url', 'type'],
proxy: {
type: 'ajax',
url : 'icons.json',
reader: {
type: 'json',
root: ''
}
}
});
this.callParent(arguments);
this.store.sort();
}
});