Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Extjs4.1, how to add additional params before one store sync?

In store, there is an event beforeload:

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

by listening to this event, i can add my additional param to operation when i do query action, like this:

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

i also need add my additional params when i do create, update and destroy action. However, the sync event do not pass the operation or store:

beforesync( Object options, Object eOpts )

is there any other way?

like image 708
txx Avatar asked Jun 08 '13 10:06

txx


2 Answers

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

like image 190
Sebastião Relson Avatar answered Sep 30 '22 11:09

Sebastião Relson


Use

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

like image 30
Harshal Avatar answered Sep 30 '22 12:09

Harshal