View Full Version : Some advise needed about setting ExtraParams in the store's proxy with Extjs 4.

1 Sep 2011, 7:39 AM

Just looking for a bit of advise here. Is the following way of setting the value of the post parameters for a store "load" method, the way to go? Or are there better ways to do it. I don't like it so much to set parameters directly, without calling a function, given by the framework. It would be nice to have something like "store.setExtraParams".

// set an additional parameter before loading, not nice but effective
store.getProxy().extraParams.someparameter1 = newValue1;
store.getProxy().extraParams.someparameter2 = newValue2;
scope : this,
callback: function(records, operation, success) {
this.ProcessSomethingUseful(records, operation, success);

Thanks in advance.


1 Sep 2011, 7:58 AM
In Ext 3, you can set params in the load-call directly:

params : {...}

this should be possible in 4 too.

you can also use the beforeLoad event to change params.

the question is: do you want those params for ALL requests, then setting extraParams is fine. if it is just for this one call, i would go for the direct way.

when adding more than one value to extraParams i would go for:

Ext.apply(store.getProxy().extraParams, {
foo : 'bar',

1 Sep 2011, 8:07 AM
Hello Tobiu,

Yes you're right by setting the parameters at store definition time. But I have some parameters that change, before the store is reloaded. I used to work in Ext 3 with the undocumented store.setBaseParams.

In my example the store is reloaded after the search field is changing and I want to refresh my results on the new value. So, yes I want this parameter constantly walking along.

And yes your "params" on the load also works in Ext 4. Just tested it and this does the job too.

Thank you for your quick reply.