How to use SharePoint ‘Working on it’ modal dialog

Ahamed Fazil Buhari
 
Senior Developer
December 1, 2017
 
Rate this article
[Total: 0    Average: 0/5]
 
Views
2489

Hello everyone,

In this article we will see how to use SharePoint’s own modal dialog wherever you want. This will be useful when we are customizing SharePoint functionality or page and if we want to show this message when some background process is running and you are waiting for that so it still feels like you are in SharePoint.

 function SP_WaitScreen() {
             SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () {
                 window.parent.eval("window.waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Working on it...', '');");
             });
         }
 
         function SP_WaitScreen_Close() {
             if (window.frameElement != null) {
                 if (window.parent.waitDialog != null) {
                     window.parent.waitDialog.close();
                 }
             }
         }
 

Call SP_WaitScreen() function before initiating your big task and the window will show the below popup. You can still customize the message if you want to,

clip_image001

Once you job is over, you call SP_WaitScreen_Close() function to close the modal popup.

 

Happy Coding

Ahamed

Author Info

Ahamed Fazil Buhari
 
Senior Developer
 
Rate this article
[Total: 0    Average: 0/5]
 
Ahamed is a Senior Developer and he has very good experience in the field of Microsoft Technologies, especially SharePoint 2013, 2016 and O365, Azure, ASP.NET, SQL Server, IIS and client ...read more
 

Leave a comment