I would like to add a user interation that would cascade my Kendo Windows.
The app allows many windows open and I will add to my Menu, Window, Cascade.
What I need to work out is.
I would then write something like the below pseudo code
x = 10, y = 10
for each w window {
w.x = x;
x.y = y;
x += 10;
y += 10;
}
Kendo assigns a class of k-window-content
to all your windows. You can therefore us the jQuery each() function to iterate through all your windows. To see if a window is open, check the .options.visible
property. Then to position the windows use the .setOptions({ })
method and the toFront() method.
function CascadeWindows(){
var x = 10, y = 10;
$(".k-window-content").each(function(idx){
var kwin = $(this).data("kendoWindow");
if (kwin.options.visible) {
kwin.setOptions({
position: {
top: y,
left: x
}
});
kwin.toFront();
x += 10;
y += 10;
}
});
Working DEMO