Tell me more ×
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 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 at 0:04
I'm not able to reproduce your issue. Being on page /_layouts/14/start.aspx#/SitePages/Home.aspx, I run SP.UI.ModalDialog.showModalDialog({url:'/_layouts/settings.aspx'}) from IE developer tools and the dialog shows just fine. The portal is Office365 E3. Can you provide more details? – Andrey Markeev Mar 8 at 9:08
@AndreyMarkeev in your example /_layouts/settings.aspx is not a mds page. Try SP.UI.ModalDialog.showModalDialog({url:some_mds_url}) – Christophe Mar 8 at 17:08
1  
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 at 21:45
show 2 more comments

1 Answer

//Using a generic object.
var options = {
    title: "This is the Home title",
    width: 400,
    height: 600,
    url: "/_layouts/15/start.aspx#/SitePages/Home.aspx" };

SP.UI.ModalDialog.showModalDialog(options);

http://msdn.microsoft.com/en-us/library/ff410058(v=office.14).aspx

make sure /_layouts/15/start.aspx#/SitePages/Home.aspx is correct, copy past into webbrowser to see the page ;) if it is that your all good togo!

how are you calling the function above?

onclick="javascript:openDialog(); return false;"

the return false says not to send a postback, that could be the issue with the dialog closing!


if that doesnt solve your problem than also try this together:

//Using a generic object.
var options = {
    title: "This is the Home title",
    width: 400,
    height: 600,
    url: "/_layouts/15/start.aspx#/SitePages/Home.aspx" 
    dialogReturnValueCallback: CloseCallback};

options.dialogReturnValueCallback = Function.createDelegate(
     null, CloseCallback);

SP.UI.ModalDialog.showModalDialog(options);

//call this when you run the dialog:

function startTimer()
 {
       var timer = $find("<%=ajaxTimer.ClientID%>")
      timer._startTimer();
 }

//call this when you CloseCallback function

 function stopTimer()
 {
       var timer = $find("<%=ajaxTimer.ClientID%>")
      timer._stopTimer();
 } 

http://social.technet.microsoft.com/forums/en-US/sharepointgeneralprevious/thread/d5082892-61f8-47cc-8570-1fb7705b98ab

share|improve this answer
Interesting... I'll try "return false", that could be my issue. – Christophe Mar 26 at 16:20
Just checking: is this code working for you? If so, did you test it on premises or in Office 365? – Christophe Mar 26 at 16:41
tbh I havent tested it myself its just what iv spotted and my understanding javascript! – ali Sharepoint Mar 26 at 16:46
ok. My question is really about a SharePoint bug, not so much an "how do I" question. If you can test it I'd be very interested in the result! – Christophe Mar 26 at 16:51

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.