direct-grid.js
1.06 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
Ext.require([
'Ext.direct.*',
'Ext.data.*',
'Ext.grid.*',
'Ext.util.Format'
]);
Ext.define('Company', {
extend: 'Ext.data.Model',
fields: ['name', 'turnover']
});
Ext.onReady(function() {
Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);
// create the Tree
Ext.create('Ext.grid.Panel', {
store: {
model: 'Company',
remoteSort: true,
autoLoad: true,
sorters: [{
property: 'name',
direction: 'ASC'
}],
proxy: {
type: 'direct',
directFn: TestAction.getGrid
}
},
columns: [{
dataIndex: 'name',
flex: 1,
text: 'Name'
}, {
dataIndex: 'turnover',
align: 'right',
width: 120,
text: 'Turnover pa.',
renderer: Ext.util.Format.usMoney
}],
height: 350,
width: 600,
title: 'Company Grid',
renderTo: Ext.getBody()
});
});