0
我試圖從Ext-js-4調用一個服務調用時得到'中止'錯誤的解決方案。 我做異步attirbute爲'假',根據我的理解,這將使請求作爲同步。以下是我的商店代碼,它具有代理定義。獲取中止錯誤的Ext-js-4 Ajax請求同步調用
Ext.define('RD.store.Rules', {
extend: 'Ext.data.Store',
requires: 'RD.model.Rules',
model: 'RD.model.Rules',
proxy: {
type: 'ajax',
async : false,
url: '/admin/client/test/list.in',
actionMethods: {
create: 'POST',
read: 'GET',
update: 'POST',
destroy: 'POST'
},
reader: {
type: 'json',
root: 'rules'
}
},
autoLoad: false,
autoSync: false,
// Event listeners
listeners: {
'beforeload': function(self, operation) {
console.log('RD.store.Rules beforeload');
console.log(self, operation);
self.total = null;
self.returned = null;
},
'load': function(self, records, successful) {
console.log('RD.store.Rules load');
console.log(self, records, successful);
var data = self.getProxy().getReader().rawData;
self.total = data.total;
self.returned = data.returned;
}
}
});
如果我通過使用此代理調用請求,我會在27秒後得到'中止'錯誤。 出於測試目的,我加的超時屬性來代理這個變化我能得到結果後40〜50秒後如下
proxy: {
type: 'ajax',
async : false,
**timeout: 300000,**
url: '/admin/client/test/list.in',
。
我們可以在不使用超時屬性的情況下避免此錯誤嗎?沒有必要爲同步請求提供超時屬性?
請分享您的寶貴意見。
謝謝
嗨Rixo,THX爲u'r意見。我通過設置更高值的超時來修復它。 –