ASP.NET Core - Open multiple instance of same Kendo Window

1 Answer 382 Views
Window
Miguel
Top achievements
Rank 1
Miguel asked on 10 Aug 2021, 04:27 PM

Hello, I have a page with a Kendo Grid where every row has a custom button to open a Kendo Window.

Like this:

 

 

When user click exit button opens this Kendo Window:

 

 

This is my current code:

 

 

And this is button click:

 

I want to allow user to click multiple times in exit button and open different kendo windows but when user click in exit button I open a new windows with same id and replace previous one.

Is there any way to implement this behaviour(allow multi kendo windows)?

BR, Miguel Machado


 

1 Answer, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 13 Aug 2021, 07:11 AM

Hi Miguel,

In general, there should be not issue when there are multiple Window widgets on the page, as long as their name and id attributes are different(specified through the .Name() option). Duplicate initialization, meaning creating multiple widgets from the same DOM element, might lead to undesired side effects.

That said, you can reuse the existing window instance, as you already do, to load different content in it, however you will have a single instance opened. If you desire to have multiple Window instances, showing different content, I can suggest the following:

  • consider adding a <div> element with unique name and id attributes to the commands column, for example.
  • whenever the user clicks the Exit button initialize a Window from this element and set it's content.

You will need to include a check on whether an instance already exist, for example:

success:function(result){
  var wnd = $("#WindowElementId").getKendoWindow(); // use id of DOM element for current row
    if(!wnd){
    	//initialize Kendo Window
      wnd = $("#WindowElementId").kendoWindow({
      	   //window options
        }).getKendoWindow();
    }
    wnd.content(result);
    wnd.center().open()
  }

I hope the above help.

Regards,
Aleksandar
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
Miguel
Top achievements
Rank 1
Answers by
Aleksandar
Telerik team
Share this question
or