extjspaginationstore

Return to first page of Extjs 4 grid


I developed Extjs 4 grid with paging. In some event I need to refresh the grid and to return to first page.

So far I manage to refresh data but I cannot manage to put to the first page :

function RefreshData() {
    var data = globalStore;
    var store = grid.getStore();
    store.load({ params: { start: 0, limit: itemsPerPage} });
    var proxy = store.getProxy();
    proxy.url = "";
    proxy.url = getDataWithPageURL;
    grid.getStore().load();

}

As you see above,

store.load({ params: { start: 0, limit: itemsPerPage} });

In the line above I try to put to the first row but it's not working?


Solution

  • I found how to do it . I need to use loadPage function

    Below is fixed function

    function RefreshData() {
        var store = grid.getStore();
        store.loadPage(1); 
    }