Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Sorting the store doesn't update the sort headers #40

Open
jacobweber opened this issue Mar 13, 2013 · 3 comments
Open

Sorting the store doesn't update the sort headers #40

jacobweber opened this issue Mar 13, 2013 · 3 comments

Comments

@jacobweber
Copy link

If you sort your grid's store manually (e.g. by calling store.sort(...), the grid's column headers don't update.

I was able to fix it by changing Sorter.js like this:

    init : function(grid) {
        [...]
        store.on('sort', this.onSort, this);
    },

    onSort: function() {
        var grid = this.getGrid();
        if (grid.rendered) {
            grid.fireEvent('sort');
        } else {
            grid.on('painted', function() {
                grid.fireEvent('sort');
            }, null, { single : true });
        }
    },

    onDestroy: function() {
        [...]
        grid.getStore().un('sort', this.onSort, this);
    },

Note that this requires the "destroy" fix from issue #37.

@mitchellsimoens
Copy link
Owner

Thank you for looking into this. You do know that github has a feature (pull requests) to handle things like this right?

@jacobweber
Copy link
Author

Yeah, sorry about that. I was being lazy.

@jacobweber
Copy link
Author

I'm thinking that you can also get rid of this code from handleHeaderTap, since the store (and the grid's onSort handler) should take care of it:

        if (store.getRemoteSort() === true) {
            store.load();
        } else {
            grid.refresh();
        }

        grid.fireEvent('sort');

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants