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

Opening Windows Dynamically

1 Answer 82 Views
Window
This is a migrated thread and some comments may be shown as answers.
Paula
Top achievements
Rank 1
Paula asked on 25 May 2015, 05:42 AM

I would like to use the kendoui window to open a dynamic number of windows and ideally if that window already existed by name it would just show the same window.

 

So i'm imagining a javascript function

 

win(name, url, width)

 

 

And I would call this from various places

 

<button onclick="win('my window', '/example/view', 100);">click me</button>

 

Im not really sure how to create a window like this using its name and how to check if it already exists.

 

The app is very simple, a range of menus and each menu opens a window, but the menu is driven from database content, thus I cant predefine all the windows

1 Answer, 1 is accepted

Sort by
0
Plamen Lazarov
Telerik team
answered on 26 May 2015, 02:22 PM

Hello Paula,

Please take a look at the following demo page, which demonstrates how to initialize the window, store it's instance in a variable and then use it to check if the window already exists. This is achieved via the following code snippet:

if (!window.data("kendoWindow")) {
   window.kendoWindow({
      width: "600px",
      title: "About Alvar Aalto",
      actions: [
        "Maximize",
        "Close"
      ]
          });
 }

After the window has been initialized, it's content() and refresh() API methods could be used to set static content or retrieve it from remote URL.

Let me know if that helps.

Regards,
Plamen Lazarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Window
Asked by
Paula
Top achievements
Rank 1
Answers by
Plamen Lazarov
Telerik team
Share this question
or