Extjs store.sync超时弹出失败消息
这是datastore.sync,包含成功和失败,Extjs store.sync超时弹出失败消息,extjs,Extjs,这是datastore.sync,包含成功和失败, 但是当超时时,我想grid.setLoading(false) 如何在这里实现这个功能?假设30秒后将自动超时并弹出消息更新失败
但是当超时时,我想
grid.setLoading(false)代码>
如何在这里实现这个功能?假设30秒后将自动超时并弹出消息更新失败使用grid.setLoading隐藏加载(false)代码>您必须侦听服务器(在您的RouteSeqStore中)传递的异常
查看文档:
var BtnRouteSeqSave = Ext.getCmp('BtnRouteSeqSave');
var grid = Ext.getCmp('MyGridPanelRouteSeq');
grid.setLoading(true);
BtnRouteSeqSave.on('click', function(){
RouteSeqStore.sync({
success: function(batch) {
//var button = Ext.getCmp('BtnRouteSeqRefresh');
//button.fireEvent('click', button); //need at here , if not too fast refresh will get the old data
grid.setLoading(false);
Ext.MessageBox.show({
title: "Information",
msg: batch.operations[0].request.scope.reader.jsonData["message"],
icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK,
fn: function(buttonId) {
if (buttonId === "ok") {
//EditWin.close();
}
}
});
},
failure: function(batch){
//var button = Ext.getCmp('BtnRouteSeqRefresh');
//button.fireEvent('click', button); //need at here , if not too fast refresh will get the old data
grid.setLoading(false);
RouteSeqStore.rejectChanges();
Ext.MessageBox.show({
title: "Error",
msg: batch.operations[0].request.scope.reader.jsonData["message"],
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK,
fn: function(buttonId) {
if (buttonId === "ok") {
//EditWin.close();
}
}
});
}
});
})
Ext.define('xxx.store.xxx', {
extend: 'Ext.data.Store',
autoLoad: false,
requires: [
'xxx.model.xxx'
],
model: 'xxx.model.xxx',
proxy: {
type: 'ajax',
limitParam: null,
timeout: 60000,
url: 'bin/script.php',
reader: {
type: 'json',
root: 'data',
idProperty: 'xid'
},
// maybe this is what you need
listeners: {
exception: function (this, response, operation, eOpts) {
// TIMEOUT DO SOMTHING
}
}
}
});