我有一个带有ajax代理和json阅读器的ExtJS商店:
@H_301_2@Ext.create('Ext.data.Store',{
proxy: {
type: 'ajax',url: '...',reader: {
type: 'json',root: 'data',totalProperty: 'totalCount',messageProperty: 'message',successProperty: 'success'
},...
这是我从服务器获得的:
@H_301_2@data: [...] message: "I want to read this string after the store is loaded" success: true totalCount: x现在我想在加载商店时访问“消息” – 我从哪里获得它?我看了很多,但我找不到一个可以挂钩的地方?代理中唯一的侦听器是异常,这对我没有帮助.
解决方法
使用商店
load
活动:
@H_301_2@Ext.create('Ext.data.Store',{
listeners: {
'load': function(store,records,successful,operation) {
alert(operation.resultSet.message);
}
},proxy: {
// ...
UPDATE
似乎加载事件的文档是错误的.正确的参数列表是(存储,记录,成功)(无操作参数).因此上述解决方案无效.
@H_301_2@Ext.create('Ext.data.Store',successful) { alert(store.getProxy().getReader().rawData.message); } },proxy: { // ...