How to determine if Window is open

7 posts, 1 answers
  1. ScopiaRx_CTO
    ScopiaRx_CTO avatar
    9 posts
    Member since:
    Aug 2007

    Posted 23 Jan 2013 Link to this post

    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?
  2. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 25 Jan 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. akj
    akj avatar
    7 posts
    Member since:
    Nov 2013

    Posted 27 Nov 2013 Link to this post

    That works . Thanks
  5. Jarno
    Jarno avatar
    3 posts
    Member since:
    May 2013

    Posted 02 Sep 2014 Link to this post

    Does this really work? It's always false.
  6. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 02 Sep 2014 Link to this post

    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!
     
  7. Jarno
    Jarno avatar
    3 posts
    Member since:
    May 2013

    Posted 02 Sep 2014 in reply to Alexander Valchev Link to this post

    http://dojo.telerik.com/IFeVe/9

    Updated Dojo. So i want to close Window when TabStrip tab changes.
  8. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 02 Sep 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready