1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Hamburg, Germany
    Posts
    97
    Vote Rating
    0
    ctp is on a distinguished road

      0  

    Default Unanswered: Sorting grid: how to skip empty fields

    Unanswered: Sorting grid: how to skip empty fields


    Hi folks,

    I have a grid with few columns i wanna sort on. There's a column e.g. called 'Users country' where the value can be NULL and the field remains empty. The live grid manages dozens of thousands of rows which is fine but the ascending sorting on this column shows me all the rows where the country is NULL at first and somewhere later there appears the first row with AD (Andorra), AE (UAE) etc. The problem is to find this first row in a large grid.

    So the question is: is there a way to skip rows where the current sort field is NULL and simple jump to the first row where it isn't?

    Thanks for help in advance,
    Chris
    Cheerio,

    Chris

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,987
    Answers
    464
    Vote Rating
    649
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      1  

    Default


    Set the sortType on the field:

    Code:
    {
        name: 'country',
        sortType: function(v){
            if (Ext.isEmpty(v) {
                // higher ascii value than alpha chars
                return '~';
            }
            // Sort case in dependent.
            return v.toLowerCase();
        }
    }
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    May 2010
    Location
    Hamburg, Germany
    Posts
    97
    Vote Rating
    0
    ctp is on a distinguished road

      0  

    Default


    Thanks Evan,

    thanks for the prompt reply. Now another problem arises: I'm using Sencha Architect for the project. There's just a dropdown menu in 'sortType' (asDate, asFlow, asText etc.). No way to define a custom sortType It seems to fit exactly into http://www.sencha.com/forum/showthre...-a-field-in-SA. Any ideas?

    And it seems it's not possible to override just one field in Sencha Architect, right?
    Cheerio,

    Chris

Thread Participants: 1

Tags for this Thread