关闭Sitecore 7.1中的模态对话框?

Der*_*ker 3 sitecore sitecore7 sitecore7.1

我有一个自定义对话框,使用以下调用打开ASPX页面:

Sitecore.Context.ClientPage.ClientResponse.ShowModalDialog("/path/to/my/dialog.aspx");
Run Code Online (Sandbox Code Playgroud)

在Sitecore 7.1之前,我已经能够关闭模态对话框并使用以下JavaScript代码段传回一个值:

if (window.opener) {
  window.opener.top.returnValue = 'success';
}
window.returnValue = 'success';
window.close();
Run Code Online (Sandbox Code Playgroud)

由于我的对话框使用的是ASPX页面,因此我无法使用Sitecore.Context.ClientPage.ClientResponse.CloseWindow();它来关闭它(因为Sheer UI框架不存在).不幸的是,我的自定义对话框非常复杂,我的项目时间表让我没有时间将其重写为SPEAK UI应用程序.

话虽这么说,由于新的jQuery驱动模式对话框,上面的JavasScript解决方法已停止在Sitecore 7.1中工作.我想知道是否有人知道如何关闭Sitecore 7.1模式对话框并传回一个值?

Jen*_*sen 6

你可以打电话 window.top.dialogClose();

这应该够了吧.

  • 太棒了,这就行了!只需注意`window.top.returnValue ='success';`传回一个值. (2认同)