Window will only close once

2 posts, 0 answers
  1. Chris
    Chris avatar
    19 posts
    Member since:
    Feb 2016

    Posted 23 May Link to this post

    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

  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2155 posts

    Posted 24 May Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top