Kendo UI Window Cascade Open windows

217 views Asked by At

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.

  1. Can I get a list of Kendo Windows
  2. Can I check if they are open or not
  3. Can I set the x,y for these windows.

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;
}
1

There are 1 answers

0
ezanker On BEST ANSWER

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