Reputation: 7030
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?
Upvotes: 2
Views: 6025
Reputation: 21
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.
Upvotes: 0
Reputation: 21
window.parent.$("#otherCusLogInWindow").data("kendoWindow").close()
Upvotes: 2
Reputation: 21
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.
Upvotes: 2
Reputation: 30671
Try this:
$("#otherCusLogInWindow").data("kendoWindow").close();
Here is the documentation about getting the client-side object reference: http://docs.kendoui.com/getting-started/web/window/overview#accessing-an-existing-window
Upvotes: 2