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?


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


Use

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


ExtraParam will only take effect when call the read api. Not work for create, update, delete

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

I try another way.

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

Java can get the param by

request.getParameter("paramA");
链接地址: http://www.djcxy.com/p/14048.html

上一篇: 是否执行锁定配置文件用户空间互斥?

下一篇: 在Extjs4.1中,如何在一次存储同步之前添加额外的参数?