admin管理员组文章数量:1334935
According to this page, all I have to do is call the following code from the content of the window since I am not using iframe:
$(buttonInsideWindow).closest(".k-window-content").data("kendoWindow").close();
It doesn't work. When I try to close this manually from the console, it returns a null when you try to retrieve the kendoWindow. (That is, it returns the correct div when $(buttonInsideWindow).closest(".k-window-content")
is invoked but the .data("kendoWindow")
on it returns null).
I am using a custom button inside the window content which calls the close event manually. This is how I invoke the window in the first place:
function otherCusLogInWindow_Open()
{
var otherCusLogInWindow = $("#otherCusLogInWindow");
otherCusLogInWindow.kendoWindow({
width: "535px",
height: "850px",
title: "ASDF",
modal: true,
actions: ["Minimize", "Maximize", "Close"],
content: "otherCusLogIn.jsp",
iframe: false,
visible: false,
draggable: true,
resizable: true
}).data("kendoWindow").center().open();
}
And inside the window content, close event is trivial:
function closeWindow(parentFuncCall) {
$("#otherCusLogInWindow").closest(".k-window-content").data("kendoWindow").close();
}
Just to get this out of the way, I am not able to use iframe for other reasons. I need to get this to work in its current state.
How can I solve the issue?
According to this page, all I have to do is call the following code from the content of the window since I am not using iframe:
$(buttonInsideWindow).closest(".k-window-content").data("kendoWindow").close();
It doesn't work. When I try to close this manually from the console, it returns a null when you try to retrieve the kendoWindow. (That is, it returns the correct div when $(buttonInsideWindow).closest(".k-window-content")
is invoked but the .data("kendoWindow")
on it returns null).
I am using a custom button inside the window content which calls the close event manually. This is how I invoke the window in the first place:
function otherCusLogInWindow_Open()
{
var otherCusLogInWindow = $("#otherCusLogInWindow");
otherCusLogInWindow.kendoWindow({
width: "535px",
height: "850px",
title: "ASDF",
modal: true,
actions: ["Minimize", "Maximize", "Close"],
content: "otherCusLogIn.jsp",
iframe: false,
visible: false,
draggable: true,
resizable: true
}).data("kendoWindow").center().open();
}
And inside the window content, close event is trivial:
function closeWindow(parentFuncCall) {
$("#otherCusLogInWindow").closest(".k-window-content").data("kendoWindow").close();
}
Just to get this out of the way, I am not able to use iframe for other reasons. I need to get this to work in its current state.
How can I solve the issue?
Share Improve this question edited Nov 20, 2014 at 13:53 Brian Mains 50.7k35 gold badges155 silver badges260 bronze badges asked Mar 28, 2013 at 7:00 TtT23TtT23 7,05035 gold badges105 silver badges177 bronze badges4 Answers
Reset to default 2Try this:
$("#otherCusLogInWindow").data("kendoWindow").close();
Here is the documentation about getting the client-side object reference: http://docs.kendoui./getting-started/web/window/overview#accessing-an-existing-window
When your content page returned a view, not a partial view, then maybe get this problem, because your content page has a new reference of jquery.js
. So the jquery
data method didn't work.
window.parent.$("#otherCusLogInWindow").data("kendoWindow").close()
One thing to be aware of is that if you can close the window when it is an iframe but the window reference is null otherwise, you are probably importing an additional jquery reference. The second jquery reference will have a different scope that the first where the Kendo window was created.
本文标签: javascriptUnable to close window from its content in Kendo WindowStack Overflow
版权声明:本文标题:javascript - Unable to close window from its content in Kendo Window - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742309739a2450626.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论