PDA

View Full Version : Sort the date column in grid on clicking of the header



puru.verma04
22 Jul 2014, 6:11 AM
In my page I have date column inside my grid On clicking of the column header the date is not sorting properly. Tag is like this

{id:'dateOfBirth',header: 'DOB', flex:1,sortable: true, dataIndex: 'dateOfBirth',filterable: true,filter: {type: 'date', dateFormat : 'd-M-Y'}}

01-jan-1990
01-feb-1990
12-jan-1990
02-mar-1990

when ever i am clicking on header of column thats showing wrong , its not sorting correctly .
its showing like .
01-jan-1990
01-feb-1990
02-mar-1990
12-jan-1990
its wrong ..

correct answear is like ..
01-jan-1990
12-jan-1990
01-feb-1990
02-mar-1990


plz help me how to solve this problem

CodyOss
22 Jul 2014, 11:07 AM
Try this.{id:'dateOfBirth',header: 'DOB', flex:1,sortable: true, dataIndex: 'dateOfBirth', renderer: Ext.util.Format.dateRenderer('d-M-Y')}

mdarretta
18 Feb 2016, 1:55 PM
i tried this and still not working. Does date input data need to be is specific format? mine is mm/dd/yyy
type: 'json'
but it's still sorting like a string.
i have this in my column def.
renderer: Ext.util.Format.dateRenderer('m/d/Y'),