SP.UI.ModalDialog.showWaitScreenWithNoClose and showModalDialog

Gotta love undocumented features. I have come to learn thanks to Sharepoint 2013 that for both the showModalDialog function and the showWaitScreenWithNoClose function you do not need to specify a height and width. If you do not provide these values SharePoint will automatically size your content for you.

I have been taking advantage of this “feature” for modal windows for quite some time. In the process of upgrading some web parts to SharePoint 2013, the larger fonts were causing problems with my wait messages. So I thought, why don’t I try and remove the height and width and see if SharePoint will handle it like it does modal windows. I removed the last two parameters and tried again and it worked beautifully.

For example change this

SP.UI.ModalDialog.showWaitScreenWithNoClose(“Processing”, “Your request is being processed. Please wait while this process completes.”, 100, 200);

to this

SP.UI.ModalDialog.showWaitScreenWithNoClose(“Processing”, “Your request is being processed. Please wait while this process completes.”);

and SharePoint will handle the sizing making it easier to deal with variable content size. Even on MSDN the parameters are not marked as optional. Hopefully they don’t pull this in the future.

1 thought on “SP.UI.ModalDialog.showWaitScreenWithNoClose and showModalDialog”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.