When developing Extjs, it often takes a period of time for the background program to be executed before the results are returned. Adding a progress bar can improve customer experience. The following are two convenient ways:
1. Use Ext.Msg before submitting data. .wait('Prompt', 'Data is being processed, please wait'); The waiting bar will pop up. After the data is processed successfully, use Ext.Msg.hide(); to remove the waiting, for example:
Ext.Msg.wait( 'Prompt', 'Data is being processed, please wait');
Ext.Ajax.request({
url:'DataAction.ashx?method=update',
params:{ItemCode:ItemCode,ItemName:ItemName},
callback:function(options,success ,response){
if(success==true)
{
Ext.Msg.hide();
Ext.Msg.alert('Prompt', 'The modification was successful. ');
}else{
alert(response.responseText);
}
}
})
2. If you are submitting a form, it is easier. Well, just configure waitMsg. The waiting prompt will disappear by itself after the data is processed, for example:
BaseInfo.getForm().submit({
waitMsg:'Saving data, please wait.',
waitTitle:'Prompt',
method:'POST ',
url:'BaseMessageAction.ashx?method=modity',
params:{ItemCode:ItemCode,ItemName:ItemName},
success:function(form,action){
}
})