PDA

View Full Version : adding extra arguments to update



Sarat Chandra Sekhar Ryal
10 Apr 2014, 9:20 AM
I am trying to set the values for the extraParams in the beforesync event, when I set the extraparams in beforesync, the values of extra params are set on the event call, but on the request they are still shown are ' '.

When I put it in datachanged event, the values are filled in the request.

code sample is below:



...
proxy: {
...
extraParams:{
rangeStartDate : '',
rangeEndDate : ''
},
....

and then in the listeners

listeners: {

datachanged: function(store, eOpts){
log().info(" in the data changed method in event store ");
var schedulergrid = Ext.getCmp('schedulergrid');
store.getProxy().setExtraParam('rangeStartDate', JSON.stringify(schedulergrid.getStart()));
store.getProxy().setExtraParam('rangeEndDate', JSON.stringify(schedulergrid.getEnd()));
},

// is not working
/*beforesync: function(options, eOpts){
log().info(" in the before sync method in event store ");
if (typeof options.update!='undefined') {
log().info(" update defined");
var schedulergrid = Ext.getCmp('schedulergrid');
for(var i=0; i< options.update.length; i++)
{
log().info(" check "+ i);
options.update[i].getProxy().extraParams.rangeStartDate = JSON.stringify(schedulergrid.getStart());
options.update[i].getProxy().extraParams.rangeEndDate = JSON.stringify(schedulergrid.getEnd());
}
}
}*/
}


Is this correct to set the extra params in datachanged?

One more observation I have is that these extraParams are now part of all requests on the eventstore, ie., Create, delete, etc., all the request are now expecting the two extra arguments in the call.

Can we restrict the extraParams to only a particular request eg: update.