Question

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.

I mean the the grid does sort data but it does not sort correctly

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'}

]
Was it helpful?

Solution

You need to set the type on the field so it knows how to sort the values:

http://docs.sencha.com/ext-js/2-3/#!/api/Ext.data.Field-cfg-type

You'll probably also need to set the dateFormat config.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top