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

Create a simple window dynamically in javascript

1 Answer 324 Views
Window
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Veteran
Robert asked on 21 Oct 2020, 05:48 PM

Using some examples I see in this forum, I am just trying to create a simple modal window on the fly via javascript.  This is called from a JS function to create and open a new window that I can then refresh the content via an ajax post call.   The line var win=... I get win = undefined.  Clearly I'm missing something basic?

$('#windowX').kendoWindow({
    width: "900px",
    height: "500px",
    title: "Add Temp Node",
    visible: true,
    modal: true,
    resizable: true,
    actions: ["Close"],
}).data('kendoWindow');
 
 
var win = $('#windowX').data('kendoWindow');
win.center().open();

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivan Danchev
Telerik team
answered on 23 Oct 2020, 02:12 PM

Hello Robert,

Do you have a div element with id windowX on the page by the time you call this logic?

  <div id="windowX"></div>

Everything in the snippet you is correct. Here it is in a dojo example: https://dojo.telerik.com/aQevenIM  

A Window is properly initialized, then a reference is obtained and the open method opens the Window as expected.

Regards,
Ivan Danchev
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
Robert
Top achievements
Rank 1
Veteran
Answers by
Ivan Danchev
Telerik team
Share this question
or