您的位置:首页 > Web前端 > JavaScript

ExtJS 5.1 WINDOW BLUR

2016-01-29 15:30 609 查看

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

How to simulate onblur event for a Panel in Extjs

ExtJS floating window focus lose detection
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: