如題。ext-4.1.1a Form表單提交後不管成功還是失敗只要設置了waitMsg屬性。遮罩層都不會消失。查了很久網上都沒有好的方案解決,有些文章上說返回必須有{'success':true},或者設置返回頭。反正一堆的沒用的解決方案。
被逼無奈只好看源代碼看問題出在哪了。原來問題在Basic.js類afterAction方法裏。看圖紅框部分。messageBox在hide前調用了suspendEvents方法。問題出在這。經調試。需要在裏面加入參數true.遮罩就會自動消失。
所以果斷重寫afterAction方法。(不建議直接在Basic.js裏改)通過原型修改
Ext.onReady(function() {
Ext.form.Basic.prototype.afterAction = function(action, success) {
if (action.waitMsg) {
var messageBox = Ext.MessageBox,
waitMsgTarget = this.waitMsgTarget;
if (waitMsgTarget === true) {
this.owner.el.unmask();
} else if (waitMsgTarget) {
waitMsgTarget.unmask();
} else {
// Do not fire the hide event because that triggers complex processing
// which is not necessary just for the wait window, and which may interfere with the app.
messageBox.suspendEvents(true);
messageBox.hide();
messageBox.resumeEvents();
}
}
if (success) {
if (action.reset) {
this.reset();
}
Ext.callback(action.success, action.scope || action, [this, action]);
this.fireEvent('actioncomplete', this, action);
} else {
Ext.callback(action.failure, action.scope || action, [this, action]);
this.fireEvent('actionfailed', this, action);
}
}
});