Results 1 to 3 of 3

Thread: Sorting grid: how to skip empty fields

  1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Hamburg, Germany
    Posts
    97
    Vote Rating
    0
      0  

    Default 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
    18,609
    Answers
    677
    Vote Rating
    874
      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
    Twitter - @evantrimboli

  3. #3
    Sencha User
    Join Date
    May 2010
    Location
    Hamburg, Germany
    Posts
    97
    Vote Rating
    0
      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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •