maTRix February 2016

Ext Js store parameters change when the grid page changes

I have a grid of which store is filtered in server side. This is the store:

var _store = Ext.create('Ext.data.Store', {
    model: isemriModel,
    storeId: 'storeFiltered' + _id,
    pageSize: 5,
    autoLoad: { filter: JSON.stringify(filterObject) },
    proxy: {
        type: 'ajax',
        actionMethods: {
            read: 'POST'
        },
        url: _url,
        extraParams: {
            kullaniciAdi: _userName,
            sifre: _password,
            filter: JSON.stringify(filterObject)
        },
        reader: {
        rootProperty: 'isemirleri',
        totalProperty: 'totalCount'
        }
    },
    listeners: {
        beforeload: function (store, operation, opts) {
        },    
        load: function (store) {
        }
    }
});

Here is my problem: When I make a search for records which contains specific letters, names etc (for example names containing a). First page appears correct. But when I change the grid page from paging toolbar, filter parameter is cleared and non filtered records appears.

I also tried

store.load({ params: { filter: JSON.stringify(filterObject) } });

but it does not work. Can anybody help?

Attention: I make the filtering at server side, not at ext store. Is it possible to load store with dynamically changing parameters using a grid with paging toolbar.

Answers


Mr.George February 2016

on load function set again your filter to the current page. Also if the store is the same, pages have differents filters. Infact probably if you try to return to the filtered page you'll se the filter isn't cleared.

simply every page can have a different filter.

remember to clear all page filters if you use the same filter in more than one page


Michel February 2016

You should use

remoteFilter: true

and the built-in filter functions for your store. Your proxy page _url will get the filter by an other way but your filter will be kept between different loads.

Post Status

Asked in February 2016
Viewed 3,203 times
Voted 7
Answered 2 times

Search




Leave an answer