关闭kendoui窗口自定义关闭按钮的窗口内 [英] Closing a kendoui window with custom Close button within the window

查看:5530
本文介绍了关闭kendoui窗口自定义关闭按钮的窗口内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的剑道UI窗口组件,它是类似于任何模态对话框。

我在这一个关闭按钮,我怎么在点击该按钮(而不是点击标题栏的默认X按钮)关闭窗口

在我的窗口中的内容是从另一种观点认为加载

  @(Html.Kendo()。窗口()
           。名称(窗口)
           .title伪(角色)
           .Content(载入中...)
           .LoadContentFrom(创建,RolesPermissions,Model.Role)
           .Modal(真)
           .WIDTH(550)
           .Height(300)
           .Draggable()
           。可见(假)
          )

在同一个观点,我有

 <跨度ID =亲潮级=BTN BTN-逆>取消< / SPAN>

这是我在我的主视图(调用窗口视图)

  $(文件)。就绪(函数(){
    变种窗口= $(#窗口),数据(kendoWindow);    $(#开)。点击(函数(五){
        window.center();
        window.open();
    });    $(#闭)。点击(函数(五){
        window.close()的;
    });
});


解决方案

基本上你已经知道如何关闭窗口 - 你需要使用关闭及其API的方法来做到这一点。

  $(#窗口),数据(kendoWindow)的close()。;

但为了处理程序附加到按钮,你需要等到内容加载视图里面 - 你需要使用的刷新事件。

例如

  $('#theWindowId')。数据()。kendoWindow.bind(刷新,功能(E){
    VAR赢=这一点;
    $('#接近')。点击(函数(){
         win.close();
    })
})

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 of clicking the default 'x' button in the title bar)

The content in my window is loaded from another view

@(Html.Kendo().Window()
           .Name("window")
           .Title("Role")
           .Content("loading...")
           .LoadContentFrom("Create", "RolesPermissions", Model.Role)
           .Modal(true)
           .Width(550)           
           .Height(300)           
           .Draggable()
           .Visible(false)
          )

In that same view, I have

<span id="close" class="btn btn-inverse">Cancel</span>

This is what I have in my main view (the view calling the window)

$(document).ready(function () {
    var window = $("#window").data("kendoWindow");

    $("#open").click(function (e) {
        window.center();
        window.open();
    });

    $("#close").click(function(e) {
        window.close();
    });
});

解决方案

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();
    })
})

这篇关于关闭kendoui窗口自定义关闭按钮的窗口内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆