PDA

View Full Version : How to add cancel option to a splashscreen



varmaj80
31 Dec 2014, 9:35 AM
Hello All,

I have a search screen and when I click the search button, I will have a splash screen coming with the following message.
var splash = Ext.getBody().mask('Retrieving data..This may take a few moments..', 'splashscreen');
Ext.suspendLayouts();

I would like to know if there is a way I can add a cancel option to this message so that when a user clicks on that cancel option, the whole search should stop. In case the user feels that the search is taking too long, he/she will click on that cancel option and the search will stop.

Is there a way to do this. Thanks in advance....

chamacs
31 Dec 2014, 4:38 PM
Instead of using a Mask, you could use an Ext.MessageBox.show({...}) to emulate the 'Retrieving data..This may take a few moments..' . And only put a Cancel button on the modal box.

Although, I'm not sure you can cancel an ajax server request.

lumberjack
6 Jan 2015, 6:36 AM
Ajax requests can be aborted by using the Ext.Ajax.abort() method.

Below is a fiddle demonstrating some example usage.

Regards,
Brian

fu3