Extjs store.on('save', afterSave(resp));

我的梦境 提交于 2019-12-12 01:47:22

问题


I have a simple ExtJs (3.4) Grid with a Writer. When the user makes some changes the store is saved to the server as follows:

store.on('save', afterSave(resp));

All is fine. However, I want to get a response as to wheather the record has been saved successfully, failed or an update conflict happed. How to best do this?


回答1:


Are you using Ext.data.proxy.Ajax to load your stores? If so, you can use the reader property to evaluate and handle the server responses.

Another option would be to make AJAX called directly and handle the responses from there as well




回答2:


I used exception listener to parse the data as suggested here. But, is this the right way to do this.

Ext.data.DataProxy.addListener('exception', function(proxy, type, action,
options, res) {
if (type == 'response') {
var success = Ext.util.JSON.decode(res.responseText).success;
if (success) {
console.log('UPDATE OK');
} else {
console.log('UPDATE FAILED');
}
}
});


来源:https://stackoverflow.com/questions/6527330/extjs-store-onsave-aftersaveresp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!