【问题标题】:How to close/hide a Window when clicking outside the Window?在窗口外单击时如何关闭/隐藏窗口?
【发布时间】:2013-07-10 14:19:28
【问题描述】:

我想在窗口外点击时关闭一个窗口, 我想我需要像窗口后面的掩码上的点击处理程序(是的,它的 modal=true)或窗口上的“onLooseFocus”处理程序......我试过这个:

windowX.Listeners.Show.Handler = "Ext.select('.ext-el-mask').addListener('click', function() {Ext.getCmp('windowX').hide();});";

但它不起作用,Firebug 中也没有错误,所以我找不到错误 - 任何人都可以帮助我吗?

编辑:我正在使用 Ext.Net 2.2

【问题讨论】:

    标签: ext.net


    【解决方案1】:

    我找到this on the ext.net forums

        <ext:Window runat="server" Modal="true">
        <Listeners>
            <Show Handler="this.mask.on('click', function () {
                                alert('I am the Mask!');
                            });"
                    Single="true" />
        </Listeners>
        </ext:Window>
    

    编辑

    由于它不起作用,返回extjs是最好的解决方案,在this answer的帮助下代码变成了

        <ext:Window runat="server" Modal="true">
        <Listeners>
            <Show Handler="this.mon(Ext.getBody(), 'click', function (el, e) {
                this.close(this.closeAction);
            }, this, { delegate: '.x-mask' });"
                    Single="true" />
        </Listeners>
        </ext:Window>
    

    【讨论】:

    • 他们一定改变了这个,没有用。抱歉,我没有提到我的 Ext.Net 版本 - 它是 2.2
    • 是的!非常感谢!
    猜你喜欢
    • 2022-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-30
    • 2023-02-09
    • 2014-02-02
    • 1970-01-01
    • 2012-12-21
    相关资源
    最近更新 更多