PDA

View Full Version : [Resolved]JsonStore reload calls server 2 times



vvorobeychik
19 Jan 2010, 7:16 AM
I use the folowing code


var daysBack = new Ext.form.NumberField({name:'daysBack',id:'daysBack', ...});
var storeJobs = new Ext.data.JsonStore({..., baseParams:{daysBack:daysBack.getValue()}});

storeJobs.setBaseParam('daysBack', daysBack.getValue());
storeJobs.reload(storeJobs.baseParams);


It works, but with behaviour I don't understand. It hits server 2 times: first time with the old parameter value, second time with new param value. Finally it works as expected, but why it hits server with the old param value?

I tried also reload() without any options, the result is the same. Is there any explanation of such behaviour?

Condor
19 Jan 2010, 7:21 AM
1. Does your store also have autoLoad:true set?
2. storeJobs.reload(storeJobs.baseParams)? Since you modified the baseParams you only need to use storeJobs.reload();

vvorobeychik
19 Jan 2010, 7:27 AM
Yes, autoLoad was set to true. I tried reload() without any parameters, the same effect.

vvorobeychik
19 Jan 2010, 8:28 AM
Forget about the question. It was my problem. if you could, delete the whole thread, please.