我正在尝试在商店中获取请求数据参数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'}});
原文地址:https://codeday.me/bug/20191102/1989487.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。