Closing a kendoui window with custom Close button within the window

前端 未结 4 1504
攒了一身酷
攒了一身酷 2021-02-07 00:02

I\'m using Kendo UI\'s window component, which is similar to any modal dialog.

I have a close button in it, how do I close the window upon clicking that button (instead

4条回答
  •  温柔的废话
    2021-02-07 00:24

    Basically you already know how to close the window - you need to do it with the close method of its API.

    $("#window").data("kendoWindow").close();
    

    But in order to attach the handler to the button inside of the view you need to wait until the content is loaded - you need to use the refresh event.

    e.g.

    $('#theWindowId').data().kendoWindow.bind('refresh',function(e){
        var win = this;
        $('#close').click(function(){
             win.close();
        })
    })
    

提交回复
热议问题