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,
Once you job is over, you call SP_WaitScreen_Close() function to close the modal popup.
Happy Coding
Ahamed
Leave a comment