简体   繁体   中英

Kendo UI Window Cascade Open windows

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM