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

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

1 Answer 185 Views
Window
This is a migrated thread and some comments may be shown as answers.
Anand
Top achievements
Rank 1
Veteran
Anand asked on 18 Nov 2020, 08:33 AM

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.

1 Answer, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 19 Nov 2020, 03:55 PM

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/.

Tags
Window
Asked by
Anand
Top achievements
Rank 1
Veteran
Answers by
Stoyan
Telerik team
Share this question
or