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

How to determine if Window is open

6 Answers 3153 Views
Window
This is a migrated thread and some comments may be shown as answers.
ScopiaRx_CTO
Top achievements
Rank 1
ScopiaRx_CTO asked on 23 Jan 2013, 04:04 PM
I need to check if the Window is already open, since calling open again on a centered window that has been dragged re-centers it.  What's te best way to determine if the window is already open?

6 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 25 Jan 2013, 01:29 PM
Hello Karl,

To determine whether a given Window widget is opened or not, you may check if it is hidden.
var wnd = $("#window").data("kendoWindow");
wnd.element.is(":hidden"); //returns true or false


Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
akj
Top achievements
Rank 1
answered on 28 Nov 2013, 02:17 AM
That works . Thanks
0
Jarno
Top achievements
Rank 1
answered on 02 Sep 2014, 07:37 AM
Does this really work? It's always false.
0
Alexander Valchev
Telerik team
answered on 02 Sep 2014, 08:51 AM
Hello Jarno,

Could you please provide a small Kendo Dojo sample which demonstrates your exact scenario?

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Jarno
Top achievements
Rank 1
answered on 02 Sep 2014, 09:23 AM
http://dojo.telerik.com/IFeVe/9

Updated Dojo. So i want to close Window when TabStrip tab changes.
0
Alexander Valchev
Telerik team
answered on 02 Sep 2014, 10:49 AM
Hi Jarno,

In your case there is no need to check if the Window is opened or not, instead may directly call the close() method of the widget. The widget will check internally if it is currently opened or not and will handle the action accordingly. You should to check only if the widget is initialized. Please see the code sample below.

function closeWindow() {
  var wnd = $("#sample-wnd").data("kendoWindow");
  if (wnd) {
      wnd.close();
  }
}


Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Window
Asked by
ScopiaRx_CTO
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
akj
Top achievements
Rank 1
Jarno
Top achievements
Rank 1
Share this question
or