Alex Sebastiano
Alex Sebastiano

Reputation: 67

How to go to first page after(before) sorting in extJs grid

I have extJs 4.1 grid with paging. For this grid applied remoteSort(maybe remoting style of sorting doesn't matter) behaviour. After sort click(click on header) I wanna go to first page. How can I achive this? Maybe exists presort callback in what I can cancel loading data and forward loading to first page with store.loadPage(1)?

P.S. Sorry for english.

Upvotes: 1

Views: 1708

Answers (1)

lontivero
lontivero

Reputation: 5275

This code is part of the FiltersFeature.js file. Take a look at how when to specify (local: false) it goes to first page automagically ;)

reload : function () {
    var me = this,
        store = me.view.getStore();

    if (me.local) {
        store.clearFilter(true);
        store.filterBy(me.getRecordFilter());
        store.sort();
    } else {
        me.deferredUpdate.cancel();
        if (store.buffered) {
            store.pageMap.clear();
        }
        store.loadPage(1);
    }
}

What you have to do is configure the feature with local: false.

Upvotes: 1

Related Questions