Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am having the following issue in SharePoint 2013 Online (Office 365 Preview): when I try to display in a modal dialog a page that relies on MDS (Minimal Download Strategy), the dialog opens but then closes immediately.

Is this a known issue, and how can I fix this?

To be more specific:

  • I am using SP.UI.ModalDialog.showModalDialog to open the dialog
  • MDS pages are pages whose url contains /_layouts/15/start.aspx#

When I remove the MDS part from the url the dialog works fine.

[Edit] To clarify, I am talking about having the mds page inside the dialog, not calling the dialog from a mds page. Something like this:

SP.UI.ModalDialog.showModalDialog({url:'/someSite/_layouts/15/start.aspx#/SitePages/Home.aspx'})
share|improve this question
    
Does this happen with every location you try to open with showModalDialog? –  James Love Feb 25 '13 at 22:42
    
@JamesLove it only happens with the mds ones. If I remove the /_layouts/15/start.aspx# it works fine. –  Christophe Feb 26 '13 at 0:04
2  
@AndreyMarkeev btw your example should be /15/ and not /14/, right? –  Christophe Mar 8 '13 at 17:16
5  
15, yes, sorry, wrote it by hand. Aha, so you're trying to pass page in mds format as the target for the dialog. I thought the problem was that you was not able to launch any dialog from mds page. Ok, now that's clear and I have one question: why do you want it? In most cases this will neither improve performance nor decrease traffic. Mds starts yielding profit only then you navigate between mds pages. In this case, the contents of the other page is loaded asynchronously. But usually you don't jump through pages within a dialog (maybe except for a wizard). –  Andrey Markeev Mar 8 '13 at 21:45
1  
@AndreyMarkeev good point, but in some cases 1/ the same pages can be used in modal and as standalone, and switching between modes adds complexity 2/ a modal dialog can be opened in full screen and serve as the startpoint for a new navigation. I have both scenarios in my implementations. –  Christophe Mar 25 '13 at 16:08

3 Answers 3

Do you wait for the SP-JS Libraries to be fully loaded? I had a few different problems with JavaScript code and confusing behaviour. You can simply add this code to your page where you open the modal dialog. "modaldialog" is the name of the function to be executed after everything has been loaded.

_spBodyOnLoadFunctionNames.push("modaldialog");

function modaldialog(){
  SP.UI.ModalDialog.showModalDialog({url:'/someSite/_layouts/15/start.aspx#/SitePages/Home.aspx'});
}
share|improve this answer
    
The dialog works fine with non-MDS pages. Have you actually tested your code successfully? –  Christophe May 26 at 16:57

I faced issue of a similar kind. I went and gave a quick study to MDS and came out with my understanding that MDS is a loading mechanism which loads the requested page async and only the difference of the page. Now when we launch a modal dialog box it get initiated from the beginning and has a blank html. So the MDS loading does not make sense here as the difference between the pages are 100% and in this case if you provide the MDS relative URL the Ajax Delta manager throws up the error saying that it is returning some value that is undefined. So loading something in a modal Dialog with MDS relative URL is not valid according to my understanding.

Thanks and Regards

share|improve this answer
    
The first time, MDS should load the whole page. It's only on the subsequent loads that the difference is loaded. –  Christophe Jun 9 at 1:56
    
Thanks Christophe for clarification. But I am still confused because for MDS to work the download manager tries to find the difference between the start.aspx and the requested page. Since we cannot provide the MDS enabled site URL containing "/../_layouts/start.aspx#/_layouts" we cannot have that working in Modal Dialog right? –  ShrinkTech Jun 10 at 8:36
    
sorry, I don't understand what you mean with "/../_layouts/start.aspx#/_layouts". In my example, I am calling "/_layouts/15/start.aspx#/SitePages/Home.aspx". –  Christophe Jun 10 at 19:45
    
Ooh..is it working fine when you are opening page -"/_layouts/15/start.aspx#/SitePages/Home.aspx" in your modal dialog.. as I got Ajax Delta manager error. –  ShrinkTech Jun 11 at 8:39

I had a similar issue and found that SP.UI.ModalDialog.showModalDialog no longer works in SP13. See the article below:

SP UI ModalDialog do not work in SharePoint 2013

share|improve this answer
    
Please add more details from the link to your post, the answer is not very helpful as of now –  Robert Lindgren Apr 18 at 17:16
    
And it works well in 2013, you just need to make sure the SP.UI.Dialog.js is properly loaded before you execute the call.. –  Robert Lindgren Apr 18 at 17:18
    
As your posted link actually states! The problem OP is having is related to opening an MDS style link in a modal dialog, not opening an actual modal –  Robert Lindgren Apr 18 at 17:20
    
@RobertLindgren not sure what you mean by "actual modal", I consider my use case an actual modal dialog! I agree that it is different from what this answer describes, and I disagree with the statement that SP UI ModalDialog doesn't work in SP 2013. –  Christophe Apr 18 at 17:52
    
@Christophe, that's what I meant, that you had no problem opening a modal, but open one with the MDS-style URL :) –  Robert Lindgren Apr 18 at 17:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.