-
17 Jul 2012 1:52 PM #1
extjs sortable does not sort on case and dates
extjs sortable does not sort on case and dates
I have a extjs grid which has an email field, that has emails beginning with upper case and lower case. This field does not sort as it should.Also, I have a date field of the format June 14, 2012 11:00 am.I am not sure how to sort the date column ascending/descending as well.Here is my code:
var init_groupView = function() {
userStore = new Ext.data.Store({
url: 'scripts/users_getAllUsers.cgi',
reader: new Ext.data.JsonReader({
root: 'users',
totalProperty: 'usersCount',
id: 'user_id',
fields: [ 'fullname','email','login_time']
})
});
Here is how my columns are sorted.
columns: [
{header: "Full Name", width: 150, height:16, sortable: true, dataIndex: 'fullname'},
{header: "E-Mail", width: 200, height:16, sortable: true, dataIndex: 'email'},
{header: "Last Login", width: 150, height:16, sortable: true, dataIndex: 'login_time'}
]
-
18 Jul 2012 5:25 AM #2
In your store define 'email' and 'login_time' as:
You may have to format login_time based on your requirement.Code:{ name: 'email', type: 'string', //Using 'String' will make it case sensitive mapping: 'email' }, { name: 'login_time', type: 'date', mapping: 'login_time' }
-
18 Jul 2012 8:16 AM #3
Thanks Jenifer
Right now the date is displayed as April 1, 2012 11:157 am etc and so on.
I am not sure how i would format it.
Should i format it while sorting and then re format it while displaying?
-
18 Jul 2012 8:34 AM #4
Check my reply to: http://www.sencha.com/forum/showthre...l=1#post855991
Using 'date' will make it sort correctly. Use renderer to format the date as required.


Reply With Quote