javascript-如何获取关于preload事件的Extjs 4存储的请求数据?
作者:互联网
我正在尝试在商店中获取请求数据参数beforeload事件.我可以看到操作对象包含请求数据,但似乎无法从操作对象中获取它
Ext.create('Ext.data.Store', {
autoLoad : true,
fields : [
{name: 'item_code', type: 'string'},
{name: 'quantity', type: 'int'},
{name: 'description', type: 'string'}
],
storeId : 'summary',
proxy : {
type : 'ajax',
actionMethods : 'POST',
extraParams : {'filter': 'branch', 'branch': location },
url : 'reports/stock_summary',
reader: {
type : 'json',
root : 'data'
}
},
listeners: {
beforeload: function(store, operation, options){
console.log( operation )
}
}
});
任何想法如何在加载事件之前获取请求对象并在该请求对象内部获取数据?
解决方法:
如何尝试operation.request.params
我认为这可以帮助您…
var test = Ext.create('Ext.data.Store', {
autoLoad : true,
fields : [
{name: 'item_code', type: 'string'},
{name: 'quantity', type: 'int'},
{name: 'description', type: 'string'}
],
storeId : 'summary',
proxy : {
type : 'ajax',
actionMethods : 'POST',
extraParams : {'filter': 'branch', 'branch': location },
url : 'reports/stock_summary',
reader: {
type : 'json',
root : 'data'
}
},
listeners: {
beforeload: function(store, operation, options){
console.log( 'manual load ' + operation.params );
console.log( operation.params );
console.log( 'proxy defined params ' + store.proxy.extraParams );
console.log( store.proxy.extraParams )
}
}
});
test.load({params: {test: '123'}});
标签:extjs,extjs4,extjs-mvc,javascript 来源: https://codeday.me/bug/20191102/1989487.html