Reloading a json store with new parameters ExtJs Ext.data.JsonStore

Viewed 45937

I am currently having trouble of reloading a json store with new parameters. Here is my store:

 newsletters = new Ext.data.JsonStore({
        url: '/newsletters/',
        root: 'results',
        fields: [
             'id',
             'body'
             'recipients'
        ],
        baseParams: { command: 'json', to: dateTo, from: dateFrom },
    autoLoad: true
    });

dateTo and dateFrom are initally empty strings ( '' ) and checking in firebug /newsletters is called with the correct parameters.

Now none of the following techniquest work:

Changing the values of dateTo and dateFrom then calling newsletters.reload() still calls the page with the parameters to and from being empty strings.

Calling newsletters.reload( { to: 'test1', from: 'test2' } ); still sees the parameters as empty strings.

Finally as from the manual I have tried:

lastOptions = newsletters.lastOptions;
Ext.apply(lastOptions.params, {
    to: 'test1',
    from: 'test2'
});
newsletters.reload(lastOptions);

This again does not request /newsletters with the updated parameters.

Any advice appreciated!

3 Answers
Related