1. #1
    Sencha User
    Join Date
    Jul 2008
    Location
    Melbourne, Australia
    Posts
    71
    Vote Rating
    2
    ben_dog is on a distinguished road

      0  

    Question Case insensitive alphabetical sorting in gridpanel

    Case insensitive alphabetical sorting in gridpanel


    Hi,

    Running into a bit of an issue. Maybe someone knows how to fix it.

    In the gridpanel, the sorting of columns seems to based on ascii value (ie A < B < a < b).

    I would like the sorting to working without the case sensitiveness (like A < a < B < b).

    I could be done easily with a custom sort method I guess but I can't see any way to provide a custom sort method for a column.

    Can this be done?

    Thanks!

    Ben

  2. #2

  3. #3
    Sencha User
    Join Date
    Jul 2008
    Location
    Melbourne, Australia
    Posts
    71
    Vote Rating
    2
    ben_dog is on a distinguished road

      1  

    Default


    ah, never noticed that sortTypes thing.

    Came across this thread http://extjs.com/forum/showthread.php?t=2532 which says string type should automatically be sorted case insensitive.

    Fixed it by specifying the 'type' for my store's fields property.

    So changed
    Code:
    store = new Ext.data.JsonStore({
         /* ... */
         fields : [ /* ... */ , 'title', /* ... */]
    })
    to
    Code:
    store = new Ext.data.JsonStore({
         /* ... */
         fields : [ /* ... */ , {name:'title', type: 'string'}, /* ... */]
    })
    And that seems to have fixed it.

    I would have thought string would have been the default type though somehow

    Anyway, it's fixed!

    Ben

  4. #4
    Sencha User
    Join Date
    Apr 2014
    Posts
    1
    Vote Rating
    0
    akaukuntla@hiremojo.com is on a distinguished road

      0  

    Default Thanks

    Thanks


    Code:
    fields: ['id', {name: 'name', type: 'string'}]
    Other posts wanted me to create custom sort functions which I didn't want to.
    Above line of code fixed my sort problem. I voted for you. Thanks!!!