SheerResponse 没有关闭

SheerResponse doesn't close

这是 Sitecore 8 Update 2 MVC 网站的一部分,我正在扩展 TreelistEx 字段

我创建了一个 sheerrepsonse modaldialog,用这段代码调用。

namespace be.absi.kbs.extensions
{
   class AbsiTreeListEx : TreelistEx, IMessageHandler
   {

   void IMessageHandler.HandleMessage(Message message)
    {
        if (message == null)
        { return; }

        if (message["id"] == null)
        { return; }

        if (!message["id"].Equals(ID))
        { return; }

        var fieldInfo = _fieldInformation[message["id"]];

        switch (message.Name)
        {
            case "treelist:edit":
                var nvcEdit = new NameValueCollection { { "source", fieldInfo.Source } };
                Sitecore.Context.ClientPage.Start(this, "Edit", nvcEdit);
                break;

            case "absitreelistex:absiadd":
                var nvcAdd = new NameValueCollection {{"clientFieldId",  message["id"] } };
                Sitecore.Context.ClientPage.Start(this, "AddItem", nvcAdd);
                break;
        }
    }

    protected void AddItem(ClientPipelineArgs args)
    {
        if (args.IsPostBack)
        {
            // Get information from args
        }
        else
        {
            SheerResponse.ShowModalDialog("/QuickContact.html",true);
            args.WaitForPostBack();
        }
    }
    }
}

这是模态对话框的html:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base target="_self">
<title></title>
<script type="text/javascript">
    function sendResponse() {
        var o = new Object();
        o.forename = document.getElementById("FirstNameId").value;
        o.surname = document.getElementById("LastNameId").value;
        o.phone = document.getElementById("PhoneId").value;
        window.returnValue = o;
    }

    function OK() {
        sendResponse();
        window.close();
        self.close();
        document.close();
    }
</script>
</head>
<body onbeforeunload="sendResponse()">
<label>First Name: </label><input type="text" id="FirstNameId" /><br />
<label>Last Name: </label><input type="text" id="LastNameId" /><br />
<label>Phone: </label><input type="text" id="PhoneId" /><br />
<a href="#" id="btnSaveImage" target="_self" onclick="OK()">
    OK
</a><br />
<input type="button" value="OK" onclick="OK()" />

我想要的是让用户填写几个字段。当用户单击“确定”时,将返回值并关闭 window。 我所缺少的只是对话屏幕的自动关闭。

我已经尝试了几乎所有我能在网上找到的东西,但仍然没有用。

有人知道我还能尝试什么吗?

我找到了关闭由 Sheerresponse 创建的模态对话框的方法:

window.parent.$('.ui-dialog-content:visible').dialog('close');