This is a migrated thread and some comments may be shown as answers.

Close all opened windows?

12 Answers 1141 Views
Window
This is a migrated thread and some comments may be shown as answers.
Michail
Top achievements
Rank 1
Michail asked on 21 Mar 2012, 06:42 PM
Hello, how it possible to find and CLOSE all opened kendo.windows ?

12 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 2
answered on 22 Mar 2012, 09:45 AM
This should point you in the direction you need to go. 
I am still new to Kendo, but this works.

<input id="winCloser" type="button" value="Close All">
<input id="winOpener" type="button" value="Open All">
<script>
$(document).ready(function() {
    $('#winCloser').click(function(){
        $('div.k-window').each(function(index) {
            $(this).hide();
        });
    });
    $('#winOpener').click(function(){
        $('div.k-window').each(function(index) {
            $(this).show();
        });
    });
    var newWin1 = $("#window1").kendoWindow(); 
    var newWin2 = $("#window2").kendoWindow();
    var newWin3 = $("#window3").kendoWindow();
    var newWin4 = $("#window4").kendoWindow();
});
</script>
<div id="window1">Kendo Window 1</div>
<div id="window2">Kendo Window 2</div>
<div id="window3">Kendo Window 3</div>
<div id="window4">Kendo Window 4</div>
0
Michail
Top achievements
Rank 1
answered on 22 Mar 2012, 02:47 PM

thanks for help!

function close_windows () {
 $('div.k-window').each(function(index) {
  $(this).hide();
 });
};

works great!

0
Michael
Top achievements
Rank 2
answered on 22 Mar 2012, 03:25 PM
no problem... glad it does what you need :)
0
DDarko
Top achievements
Rank 1
answered on 02 May 2012, 12:19 PM
$('.k-window').hide(); - It's kind of bypassing the problem ...
It does not close the window only hides the content. If you try to re-open problems may occur and if they are plugged in any event to the window on close I suppose it will not be executed.

What about modal windows?

$('.k-window').date("kendoWindow").close() - does not work.
0
DDarko
Top achievements
Rank 1
answered on 02 May 2012, 12:29 PM
I did something like that:

$('[data-role=window]').data("kendoWindow").close();

But someone figured something better ? :]
0
Bjarke
Top achievements
Rank 1
answered on 10 May 2012, 09:10 PM
I thought something like this would work:

$(".k-window .k-window-content").data("kendoWindow").close();

But it didn't. However this works:

$(".k-window .k-window-content").each(function(index, element){
  $(element).data("kendoWindow").close();
});

I figured out that my div tag with the id was wrapped in another div[class=k-window] and that my own div became a child with the class k-window-content.

I guess that a more skilled jQuery developer than I can explain what the difference is between my two example snippets.

You can see my working example on this fiddle. Note that the two windows are located on top of each other.
0
Alex Gyoshev
Telerik team
answered on 11 May 2012, 07:14 AM
Hello Bjarke,

The call to jQuery.data() returns the client-side object of the first element that has been queried.

A shorter snippet would be:

$(".k-window-content").each(function(){
  $(this).data("kendoWindow").close();
});

The shorter selector would be a bit more efficient, and since the context of the function is the element itself, one can use this instead of the arguments.

All the best,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
DDarko
Top achievements
Rank 1
answered on 11 May 2012, 07:28 AM
So I thought, that from the ready-made solutions you can create a FAQ and link them to specific widget.

for example, somewhere in http://demos.kendoui.com/web/window/index.html should be the FAQ tab (or similar) and there:
How to close all open windows?
... and the answer.

First, the new people encountering kendoUI not always reach the forum.
Second, the forum contains a lot less important things, such as requests for new features, questions without answers, etc.
Such a gathering of valuable information in one place that helped a lot IMHO.
0
Alex Gyoshev
Telerik team
answered on 14 May 2012, 09:01 AM

We just published this as a code library snippet.

All the best,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
DDarko
Top achievements
Rank 1
answered on 14 May 2012, 09:08 AM
Very cool.

Additionally in the demo (http://demos.kendoui.com/web/window/index.html), for example, next to the "Documentation" I would link to code library snippet.
0
Bjarke
Top achievements
Rank 1
answered on 14 May 2012, 09:15 AM
I would like a very direct bidirectional navigation option between library, documentation and demos. I hate to decide up front whether to navigate to e.g. documentation of window widget and then return to top and again navigate "all the way" down to the demo of the window widget. I.e. on the documentation page for the window widget I want a kind of "goto-demo-for-window-widget-link" and "goto-code-library-snippet-for-window-widget-link" - and vice versa on the other pages.
0
Alex Gyoshev
Telerik team
answered on 14 May 2012, 09:15 AM
We'll consider this for one of the next uploads of the online demos. Thanks!

Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Window
Asked by
Michail
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 2
Michail
Top achievements
Rank 1
DDarko
Top achievements
Rank 1
Bjarke
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Share this question
or