How to close a single kendo window from group of available kendo window

2 posts, 0 answers
  1. Anand
    Anand avatar
    4 posts
    Member since:
    Aug 2020

    Posted 18 Nov 2020 Link to this post

    Hi,

     

    On my page i have two kendo dialog window and both are having the same div class and trying to close the window using following code

     

    window.parent.$('.k-window-content.k-content.k-window-iframecontent').data('kendoWindow').close();

     

    But above code only close the first window not the second one. I want to close the second window.

    NOTE:window.parent.$('.k-window-content.k-content.k-window-iframecontent').length;   

    above code returns

    returns 2.

     

     

    How can i close the second window instead of first one?

     

    Kindly suggest.

  2. Stoyan
    Admin
    Stoyan avatar
    32 posts

    Posted 19 Nov 2020 Link to this post

    Hi, Anand, 
    Thank you for your question.

    You were almost there. I would suggest using the array indexes provided by the jQuery class selector. 

    var secondWindow = $(".myClass")[1];
    var window2 = $(secondWindow).data("kendoWindow");
    window2.close();

    You can get the Window widget instance for the respective index of the elements found and then close it.

    Here is a runnable example: https://dojo.telerik.com/@Stoyan/EqAWakUC

    Regards,
    Stoyan
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top