This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
/
paging.js
81 lines (74 loc) · 2.01 KB
/
paging.js
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
74
75
76
77
78
79
80
81
Ext.Loader.setConfig({
enabled : true,
paths : {
'Ext.ux.touch.grid': './Ext.ux.touch.grid'
}
});
Ext.require([
'Ext.ux.touch.grid.List',
'Ext.ux.touch.grid.feature.Feature',
'Ext.ux.touch.grid.feature.Paging',
'Ext.ux.touch.grid.feature.Sorter'
]);
Ext.define('TestModel', {
extend : 'Ext.data.Model',
config : {
fields : [
'firstName',
'lastName',
{
name : 'fullName',
convert : function(val, rec) {
var data = rec.data;
return data.lastName + ', ' + data.firstName;
}
}
],
proxy : {
type : 'ajax',
url : 'data.php',
reader : {
type : 'json',
rootProperty : 'data'
}
}
}
});
Ext.setup({
onReady: function() {
var store = Ext.create('Ext.data.Store', {
model : 'TestModel',
autoLoad : true
});
Ext.create('Ext.ux.touch.grid.List', {
fullscreen : true,
store : store,
features : [
{
ftype : 'Ext.ux.touch.grid.feature.Paging',
launchFn : 'initialize'
}
],
columns : [
{
header : 'First Name',
dataIndex : 'firstName',
style : 'padding-left: 1em;',
width : '30%'
},
{
header : 'Last Name',
dataIndex : 'lastName',
style : 'padding-left: 1em;',
width : '30%'
},
{
header : 'Full Name',
dataIndex : 'fullName',
style : 'padding-left: 1em;',
width : '40%'
}
]
});
}
});