PDA

View Full Version : Sorting is not working



mattareddy16
5 Dec 2011, 2:44 AM
Hi,
I am using below code but i am not able to sort the columns
I got error as "this.fields is undefined", Please help me regarding this issue.

var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
nocache : false,
url : '../plugins/gmitc/extjs/unsubscribes.php?task=view',
reader : new Ext.data.JsonReader({
root : 'results',
totalProperty : 'total',

fields : [
{name: 'created', type: 'date', dateFormat: 'Y-m-d h:i:s', sortable: true},
{name: 'email', sortable: true, type: 'string'}
]}),
}),
remoteSort: false
});

var grid = new Ext.grid.GridPanel({
handler : email,
loadMask : { msg: Config.load_mask, store: store },
viewConfig : { emptyText: 'Empty' },
store : store,

cm: new Ext.grid.ColumnModel([{ header : 'Email',
id : 'email',
name : 'email',
width : 120,
sortable : true,
dataIndex : 'email',
renderer : email},
{ header : 'Created Date',
width : 90,
sortable : true,
dataIndex : 'created',
renderer : Ext.util.Format.dateRenderer('Y-m-d H:i')},itemDeleter ])

findajit
5 Dec 2011, 3:11 AM
You shall be setting the fields property on the store rather than on the JsonReader.