首页 > 解决方案 > 通过单击按钮关闭检查我何时关闭 kendoWindow

问题描述

我有一个剑道窗口,当我点击剑道窗口中的关闭按钮时我需要拿起,但我无法拿起事件。

我解释说,我必须以一种特殊的方式来做。

我有一个剑道窗口,其中包含一个 iframe,这个 iframe 会根据一些参数而变化。我需要的是在加载某个 iframe 时创建一个确认(最后一个已完成),我只需要在我点击剑道窗口中的关闭按钮时能够拿起。

添加代码示例:

 if (!ventanaNombrePantalla.data("kendoWindow")) {
    ventanaNombrePantalla.kendoWindow({
        width: "300px",
        height: "117px",
        title: "Tittle",
        visible: false,
        modal: true,
        actions: ["Maximize", "Close"],
        resizable: false,
        // <%'Descripción: función que se ejecuta cuando se cierra la ventanaNombrePantalla para ocultar el div pantallaJV
        // 'Inputs:
        // 'Outputs:
        // 'DFPJSCADA0700
        // %>
        close: function (e) {
            //if ($("#ventanaNuevaPantalla").)
            $("#divPantallaJV").hide();
            dialogoAbierto = false;
            var url = $("#ventanaNuevaPantalla").attr('src').split("/")[3];//That is a iframe inside the window.

            if(url == "modalBlockLy.asp"){
                e.preventDefault();
                //Here is where i have the problem. I only want this, when the user do click on close.
                //I close the window, with two ways, with the button [X]
                //and invoing ventanaNombrePantalla.close()

            }

            $("#ventanaNuevaPantalla").attr("src", "");

            //this.content($("#body").hide());
        },
        open: function () {
            //this.content($("#body").show());
        }
    }).data("kendoWindow").center();
}

另一种方式:

$(ventanaNombrePantalla.element).closest('.k-window').find('.k-icon.k-i-close').on("click", function (e) {
    //Here, ventanaNombrePantalla.element is null...
    //debugger;
    e.stopPropagation(); // In case you want to 'prevent' the window closing
});

标签: javascriptjquerykendo-ui

解决方案


您是否尝试过使用窗口事件?

.Events(events => events.Close("myCloseEvent"))

https://demos.telerik.com/aspnet-mvc/window/events


推荐阅读