1. #1
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      1  

    Default Its.grid.feature.Sorting

    Its.grid.feature.Sorting


    Hi all,

    I've developed Its.grid.feature.Sorting that allows to multi-sort from grid interface. Here are some features:
    • Toggle between single sort and multi-sort mode (default).
    • Allow setting the order of sorting (in case of multi-sort mode) by the order of columns (default) or by order of adding sort.
    • In multi-sort mode, the sort will be updated in the following cases:
      • Change the order of columns by dragging
      • Add or remove a column from sort
    • Add a column to sort by clicking its title or select items from grid column menu.
    • Remove a column from sort by clicking its title (in case column.sortStates >= 3) or selecting an item on the grid column menu.
    • Remove all columns from sort by selecting an item on the grid column menu.
    Hope that this is useful to you. Any feedback will be welcome!

    Screenshot of grid column menu
    grid-sorting.jpg

    Source code
    Its.grid.feature.Sorting.zip

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Very nice!
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member ajaxvador's Avatar
    Join Date
    Nov 2007
    Location
    PARIS, FRANCE
    Posts
    206
    Vote Rating
    0
    ajaxvador is on a distinguished road

      0  

    Default +1

    +1


    +1
    Vador

  4. #4
    Sencha User
    Join Date
    Nov 2007
    Posts
    31
    Vote Rating
    0
    zacware is on a distinguished road

      0  

    Default


    Great! Thanks! Just what I was looking for!

  5. #5
    Sencha Premium Member dawesi's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia (aka GMT+10)
    Posts
    1,083
    Vote Rating
    44
    dawesi has a spectacular aura about dawesi has a spectacular aura about

      0  

    Default


    nice one
    Teahouse Training Company
    Official Certified Sencha Trainer

    Australia / New Zealand / Singapore / Hong Kong & APAC



    SenchaWorld.com - Sencha webinars, videos, etc
    SenchaForge.org - (coming soon)
    TeahouseHQ.com - Sencha ecosystem training portal

    Code Validation : JSLint | JSONLint | JSONPLint

  6. #6
    Ext JS Premium Member canxss's Avatar
    Join Date
    Sep 2008
    Posts
    184
    Vote Rating
    3
    canxss is on a distinguished road

      0  

    Default


    Hi,

    It seems a very nice feature. Something that I've been looking for but unfortunately I couldn't make it work on ext-4.2.0-beta. Probably because of the changes in this new version.

    First I couldn't get the feature to be inited at all then I examined the code like all other grid features it didn't have an init function to initialize and attach events. I've added an init function calling the attachEvents function inside it and it finally started to appear functioning

    Then I realized it started to clear my initial sorters and I've changed the "else if (dir == null)" as else "if (dir === null)" in doSort function.

    And at the end I found that when the Container's setSortState is called, it sets the sortState just for the first column as shown below:

    Code:
        setSortState: function(){
            var store   = this.up('[store]').store,
                // grab the first sorter, since there may also be groupers
                // in this collection
                first = store.getFirstSorter(),
                hd;
    
    
            if (first) {
                hd = this.down('gridcolumn[dataIndex=' + first.property  +']');
                if (hd) {
                    hd.setSortState(first.direction, false, true);
                }
            } else {
                this.clearOtherSortStates(null);
            }
        },
    So at the end I couldn't make a multiple sort configuration on my store to appear with the feature.

    I hope you find the time to revise this necessary feature to overcome these problems.

    Thanks in advance

    Ipek