The first time I click on the option the window opens correctly, and when I click on the "close" icon, the window closes as expected.
The second time I click on the option, the window does not open. I suspect it has something to do with the state of the window.
Listed below is my code that I use to open the window:
<script type="text/javascript">
$(document).ready(function () {
$(".menu-dialog").click(function () {
var href = $(this).attr("href");
var title = $(this).attr("title");
var myWin = $("#anchor").kendoWindow({
width: "auto",
height: "auto",
modal: false,
resizable: true,
title: title,
content: href
});
return false;
});
});
</script>
<body>
<div class="main">
<div id="anchor"></div>
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>
<div class="clear" />
<div class="footer" />
9 Answers, 1 is accepted
In order to show the window a second time, you need to call its open() method. The kendoWindow() plug-in only creates the client-side object and required HTML.
$(".menu-dialog").click(function () {
var href = $(this).attr("href");
var title = $(this).attr("title");
var myWin = $("#anchor").kendoWindow({
width: "auto",
height: "auto",
modal: false,
resizable: true,
title: title,
content: href
});
myWin.data("kendoWindow").open();
return false;
});
Kind regards,
the Telerik team

I have finally got back to trying Kendo UI...
My previous problem was fixed with the suggested additional line of code, however I now have a different problem:
If I open the window, the contents is correctly displayed (in the window). After closing the window and re-selecting the menu option, the contents is displayed but not in a window. It replaces the parent window.
Clicking the "back" button and then re-selecting the same menu option seems to fix the problem.
Any suggestions?
Mike B.
After revisiting the thread, I think that the following code should work in your scenario:
$(".menu-dialog").click(function () {
var href = $(this).attr("href");
var title = $(this).attr("title");
var myWin = $("#anchor");
if (!myWin.data("kendoWindow")) {
// window not yet initialized
myWin.kendoWindow({
width: "auto",
height: "auto",
modal: false,
resizable: true,
title: title,
content: href
});
} else {
// reopening window
myWin.data("kendoWindow")
.content("Loading...") // add loading message
.refresh(href) // request the URL via AJAX
.open(); // open the window
}
return false;
});
Kind regards,
Alex Gyoshev
the Telerik team

$('#btnOpen').click(function(){
var window = $("#window").kendoWindow({
draggable: true,
resizable: true,
width: 'auto',
height: 'auto',
title: "Modal Window",
modal: true
});
window.data("kendoWindow").open();
$('#window').css('display', '');
return false;
});
Edit: When I close the window the screen flashes as if it was modal.
You are initializing the window on every click of the button. Please examine my previous post on how to initialize it only once, or destroy the window when it is deactivated (by calling its destroy() method).
Regards,Alex Gyoshev
the Telerik team

var onClose = function () {
var myWin = new $("#Kwindow").data("kendoWindow");
myWin.destroy();
}
var myWin = new $("#Kwindow");
myWin.kendoWindow({
width: "auto",
height: "auto",
modal: false,
resizable: true,
title: title,
content: href,
close: onClose
});
The close event is triggered before the window is closed, allowing you to validate whether the window can be closed. You need to destroy it upon deactivation, i.e. in the deactivate event:
deactivate: function() {
this.destroy();
}
Alex Gyoshev
the Telerik team

- there is a chain of modal kendo ui windows(one opened by the other);
- when the last window closes it gets destoryed by calling method destroy.
but unexpectedly next windows becomes not modal - so to last windows in the chain are 'enabled' and usable.
I've analyzed in sources method destroy for window and found folowing code:
if (shouldHideOverlay) {
that._overlay(false).remove();
} else if (modalWindows.length > 0) {
windowObject(modalWindows.eq(modalWindows.length - 2), that.options.name)._overlay(true);
}
Why did developers use modalWindows.length - 2 instead of modalWindows.length - 1
Changed that code to
if (shouldHideOverlay) {
that._overlay(false).remove();
} else if (modalWindows.length > 0) {
windowObject(modalWindows.eq(modalWindows.length - 1), that.options.name)._overlay(true);
}
fixed the issue, at least visually.
What do you think about this?

DisplayDialogTemplate:
function
(title, template) {
if
(!kendoWindow) {
var
kendoWindow = $(
"<div />"
).kendoWindow({
title: title,
resizable:
false
,
modal:
true
,
content: {
template: template
},
close:
function
() { kendoWindow.data(
"kendoWindow"
).destroy() }
// $("input[id=wc-copyToClipboardDialogSelectedText]").length
});
kendoWindow.data(
"kendoWindow"
).center().open();
}
}