Company News

Dynamically Resize SharePoint Modal Dialogs

April 22, 2016

My colleague Alec and I ran into an issue today where SharePoint was having difficulty rendering modal dialogs at the correct size. The dialogs were too small for the content they contained, and therefore some undesired scroll bars appeared. Nobody wants that!

Thanks to Chad Schroeder’s post for a nifty little fix:


function resizeDLG() {
    var dlg = SP.UI.ModalDialog.get_childDialog();
    if (dlg != null) {
        dlg.autoSize();
    }
} 

setTimeout(resizeDLG, 500);

Add that to your Master Page and tweak as necessary for your purposes, and when SharePoint loads a page as a dialog it should size itself properly.

Leave a Reply

Matt Longpre

Matt Longpre

Subscribe via Email

Categories

Powered by...

itgroove Corporate Profile
Connect With Us
%d bloggers like this: