PDA

View Full Version : Gridcolumn date sorting based on year



Enew
8 Nov 2010, 7:32 AM
Hi ,

I am trying to sort date in gridcolumn using sortable: true but the problem is it is sorting based on the month which is not correct for me.All i need is to sort the date based on year.

Thanks in advance:)

plalx
8 Nov 2010, 8:09 AM
Well.. it's supposed to sort the date in order according to the year, month day and time... When configuring your fields on the store, have you specified that it's a date column, as well as the date format?

E.g.



fields: [
{ name: 'myDate', type: 'date', dateFormat: 'Y-m-d' }
]

Enew
8 Nov 2010, 4:10 PM
Hi, I am trying to add those but iam not clear where i shopuld be adding .I am getting the data through JSON and iam not creating any record.So should i be adding those in the GridColumn fields.Can you tell clearly where i should add?:)

Thanks...:)

plalx
9 Nov 2010, 5:58 AM
It's in the store definition.



var store = new Ext.data.JsonStore({
fields: [
...
]
});

Animal
9 Nov 2010, 6:46 AM
iam not creating any record.

Those damn "shortcut" classes leading people astray again!

There is ALWAYS a Record.

I've asked them to deprecate and remove the "shortcut" classes, but they won't.

They KEEP causing problems!

http://www.sencha.com/forum/showthread.php?112764-Problem-loading-Json-data-to-a-grid.&p=526084#post526084

http://www.sencha.com/forum/showthread.php?112044-combobox-assistance&p=523149#post523149

plalx
9 Nov 2010, 7:05 AM
@Animal, I guess that when the new data package that will be part of Ext 4, developers will be forced to use models and they will deprecate the rest? That would be a good thing to do...

Enew
10 Nov 2010, 8:39 AM
Thanks...It worked:)