In Extjs4.1, how to add additional parameters before one repository synchronization?

The store has an event to load:

beforeload( Ext.data.Store store, Ext.data.Operation operation, Object eOpts ) 

listening to this event, I can add my additional parameter to the operation when I execute the request, for example:

 store.on('beforeload', function(store, operation) { operation.params = Ext.applyIf({ myParam1: 'param1', myParam2: 'param2' }, operation.params); }); 

I also need to add my additional parameters when I create, update and destroy an action. However, the synchronization event does not pass the operation or saves:

 beforesync( Object options, Object eOpts ) 

Is there another way?

+7
source share
3 answers

Use store.getProxy().setExtraParams({ param: 'value', so:'on' }); hope will work fine: D

+2
source

Using

store.getProxy (). extraParams.paramName1 = paramValue1; store.getProxy (). extraParams.paramName2 = paramValue2;

+1
source

ExtraParam will only work when calling read api. Doesn't work to create, update, delete

 grid.store.getProxy().setExtraParam('paramA','XXX'); 

I try in a different way.

 grid.store.proxy.api.update = url + "?paramA=XXX"; //set before call sync() 

Java can get parameter

 request.getParameter("paramA"); 
0
source

All Articles