1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    13
    Vote Rating
    0
    surajan is on a distinguished road

      0  

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

    ]

  2. #2
    Sencha User
    Join Date
    Dec 2011
    Posts
    20
    Vote Rating
    2
    jennifer123 is on a distinguished road

      1  

    Default


    In your store define 'email' and 'login_time' as:

    Code:
    {
         name: 'email',
         type: 'string',                 //Using 'String' will make it case sensitive
         mapping: 'email'
    }, {
         name: 'login_time',
         type: 'date',
         mapping: 'login_time'
    }
    You may have to format login_time based on your requirement.

  3. #3
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    13
    Vote Rating
    0
    surajan is on a distinguished road

      0  

    Default


    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?

  4. #4
    Sencha User
    Join Date
    Dec 2011
    Posts
    20
    Vote Rating
    2
    jennifer123 is on a distinguished road

      0  

    Default


    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.

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar