ExtJS浮动窗口焦点丢失检测 [英] ExtJS floating window focus lose detection

查看:262
本文介绍了ExtJS浮动窗口焦点丢失检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种有效的方式来检测浮动窗口是否失去焦点。我有一个用户临时输入的浮动窗口,如果用户在输入操作后忘记隐藏(例如在其他地方点击),我想要自动隐藏此窗口。我试图在窗口的元素上使用模糊事件,但没有发生任何事情。
a工作演示:演示

I am wondering whether there is an efficient way to detect whether a floating window loses focus or not. I have a floating window for user's temporary inputs, what I want to do is automatically hiding this window if user forgot to hide it after input operation (e.g., clicks at elsewhere). I tried to use blur event on window's element, but nothing happened. a working demo: demo

感谢任何想法!

推荐答案

这可以实现添加模糊事件到ext窗口元素,下面是示例代码



This can be achieved adding blur event to ext window element, below is the sample code

    Ext.applyIf(me, {
        items: [
            {
                xtype: 'button',
                text: 'Done',
                listeners: {
                    click: {
                        fn: me.onDoneButtonClick,
                        scope: me
                    }
                }
            }
        ],
        listeners: {
            el: {
                blur: {
                    fn: me.onWindowLoseFocus,
                    scope:me
                }
            }               
        }
    });

这篇关于ExtJS浮动窗口焦点丢失检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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