July 1, 2013

Open SharePoint out of the box list Dialogs maximized

Application pages for SharePoint lists opens in dialogs by default. We can change it if we want to open in forms instead of dialogs by changing settings in advance settings. In list settings -> advance settings -> Launch forms in dialogs? -> select option "No" will open in Forms and "Yes" will open in Dialog.
If you want to open in maximized dialog, just add below JavaScript method in your page. And call this method in document.ready method.

   1:  function maximizeWindow() {
   2:  try {
   3:    var currentDialog = SP.UI.ModalDialog.get_childDialog();
   4:    if (currentDialog != null) {
   5:        if (!currentDialog.$S_0) {
   6:     currentDialog.$z();
   7:        }
   8:    }
   9:       } catch (e) { }
  10:   }
  11:   ExecuteOrDelayUntilScriptLoaded(maximizeWindow, 'sp.ui.dialog.js');

If you have any questions you can reach out our SharePoint Consulting team here.

No comments:

Post a Comment