Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

json

extjs

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!

like image 505
babadbee Avatar asked Jul 18 '10 23:07

babadbee


1 Answers

You can actually pass params object to the load() method

newsletters.load({   params: {to: 'test1', from: 'test2'} }) 
like image 98
Mchl Avatar answered Oct 11 '22 15:10

Mchl