当从存储中添加、更改或删除记录时,我返回{success: true|false}。(exampl {success: true, hello: 'world'})并在警报窗口中显示。但存储写入事件返回操作,其中只有success,exception,complete和其他属性,但是空的_request和_response。这可能是一个微不足道的任务,但是我还没有弄清楚操作对象。我如何才能获得响应以读取额外的参数?
{success: true|false}
{success: true, hello: 'world'}
success
exception
complete
_request
_response
2o7dmzc51#
有几种选择可以实现这一点。让我们关注存储。这取决于它是代理存储还是缓冲存储。在第一种情况下,例如使用加载事件。或者如果它是缓冲的,使用预取事件。这里有一个例子。
Ext.create('Ext.data.Store', { proxy, // set properly listeners: { load: (store, records, success, operation) => { let response = operation.getResponse(); // now you can access responseJson or responseText and decode it - depends on your ext version and proxy config } } });
Ext.create('Ext.data.Store', {
proxy, // set properly
listeners: {
load: (store, records, success, operation) => {
let response = operation.getResponse();
// now you can access responseJson or responseText and decode it - depends on your ext version and proxy config
}
});
字符串
1条答案
按热度按时间2o7dmzc51#
有几种选择可以实现这一点。
让我们关注存储。这取决于它是代理存储还是缓冲存储。
在第一种情况下,例如使用加载事件。或者如果它是缓冲的,使用预取事件。
这里有一个例子。
字符串