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

Window will only close once

1 Answer 338 Views
Window
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 24 May 2016, 12:23 AM

Hi,

I have created a kendoWindow with this code

function CustomerPopupEditor() {
    $("#showCustomerEdit").append("<div id='window'></div>");
    var myWindow = $("#window").kendoWindow({
        width: "80%",
        height: "47%",
        title: "Customer",
        content: "/Customer/CustomerEditor",
        modal: true,
        actions: [
            "Close"
        ],
        close: function (e) {
            $("#window").empty();
        }
    }).data("kendoWindow");
    myWindow.center().open();
}

 

and I am closing the window using this code

function CloseTheWindow() {
    $("#window").data("kendoWindow").close();
}

this is called on a button click event, when I get this window open, it works fine, I click my Save button it closes it. However if I open it again and try to close it, the window won't close.

I am not sure if this is enough information or if I need to add more information.

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 24 May 2016, 11:56 AM

Hello Chris,

If the CustomerPopUpEditor function is invoked multiple times, it will create multiple Window widget instances with the same id, which is not recommended. I would suggest to include a conditional check if the widget already exists. If it has already been created, you could directly use it's instance to invoke API methods e.g. open() instead of re-creating it.

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