When a user has click on update or add on the form -> loadFormData: function, I have a message to let them know that the screen is loading. When the form is successful I have the message to disappear. But there is only one user it does not close, the screen displays the loading message. I put a debugger in the function and watch the user start the message and fall into the success function. But fails to close the message. I have tried to reproduce on Chrome, Windows Explore and Edge and cannot reproduce.
loadFormData:function(id, history, callback){
var historyID = 0;
if(id==undefined) id = 0;
if(history) historyID = id;
this.getForm().reset();
var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Loading..."});
this.getForm().load({
url:'fc.php',
method:'POST',
scope:this,
params:{
_C_A:this.loadDataController,
_hid:historyID,
_uid:id
},
success:function(form, action){
this.formData = action.result.data;
this.fireEvent('afterFormSaved');
if(typeof(callback)=='function'){
callback();
}
Ext.getBody().dom.lastChild.remove();
},
failure:function(form,action){
Ext.getBody().dom.lastChild.remove();
var myMsg = 'Something went wrong while fetching form data. Please contact support';
if(action.result && action.result.msg) myMsg = action.result.msg;
Ext.Msg.show({
title:'Form failed to load',
msg:myMsg,
icon:Ext.MessageBox.ERROR
})
}
});
},`
I have tried to add a timeout but still fails in the success.
Use for Classic
Use for Modern
Explanation: All Components support mask
Also read
setMaskedOther usecases are to set loading for a grid (it is a component) via mask
Overall code quality: It might be a good idea to get a code-review for your code. Your current code, is hard to read and does not following Sencha best practices. If you are not supporting IE9 you might consider using ECMA 6 basics.