forked from henrygranados/ExtJS-NOTES
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex18-Sorting-Column-Using-sorter.html
More file actions
114 lines (90 loc) · 3.4 KB
/
index18-Sorting-Column-Using-sorter.html
File metadata and controls
114 lines (90 loc) · 3.4 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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!--Sorting a column by Default when page loas using "sorter"-->
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cat.net/ajax/libs/extjs/6.0.0/classic/theme-triton/resources/theme-triton-all-debug_1.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.2.0/ext-all-debug.js"></script>
</head>
<body>
<script type="text/javascript">
Ext.application({
name: 'MyApp',
launch: function () {
Ext.create('Ext.data.Store', {
storeId: 'CustomersStore',
fields:[ 'id', 'title', 'approved'],
autoLoad: true,
autoSync: true,
// Creating a proxy
proxy:{
type: 'rest',
url: 'example2.json',
reader:{
type: 'json',
rootProperty: 'customers'
}
},
// Sorting data (Example: email) to be displayed on Grid
sorters:[
{
property: 'email'
}
]
});
// Creating a Class -> Then creating an alias -> then using the alias in
// { xtype: myalias}
Ext.define('CustomersGridPanel', {
extend: 'Ext.grid.Panel',
alias: 'widget.customersgridpanel', // alias to be used later
title: 'Customers',
store: Ext.data.StoreManager.lookup('CustomersStore'),
columns: [
{ text: 'ID', dataIndex: 'id' },
{ text: 'EMAIL', dataIndex: 'email', flex: 1 , minWidth:100, width:75 },
{ text: 'APPROVED', dataIndex: 'approved' }
]
});
Ext.create('Ext.container.Viewport',{
layout: 'fit',
items: [
{
xtype: 'panel',
resizable: false,
layout: 'border',
collapsed: false,
items:[
{
xtype: 'container',
region: 'center',
layout:{
type:'vbox',
align: 'stretch'
},
items: [
{
xtype: 'customersgridpanel',
},
{
xtype: 'splitter'
},
{
html: '<b>Presenters</b>',
flex: 2
}
]
},
{
html: '<b>Details</b>',
flex: 2,
region: 'east',
split: true
}
]
}
]
});
}
});
</script>
</body>
</html>