码迷,mamicode.com
首页 > Windows程序 > 详细

ExtJS 5.1 WINDOW BLUR

时间:2016-01-29 20:17:54      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

Description

在ExtJS 中,当点击其他地方时,关闭 window。

Answer 1

Step 1: Register for mousedown event
this.panel.show();
Ext.getDoc().on("mousedown", this.handleDocMouseDown, this);
Step 2: Handle the event
handleDocMouseDown : function(e) {
  if (!e.within(this.panel.getEl())) {
     this.panel.destroy();
     Ext.getDoc().un("mousedown", this.handleDocMouseDown, this);
  }
}

Answer 2

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

Reference

 

ExtJS 5.1 WINDOW BLUR

标签:

原文地址:http://www.cnblogs.com/yuxiaoqi/p/5103137.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!