单击蒙版时如何关闭模态窗口extjs? [英] How to close modal window extjs when clicking on mask?
本文介绍了单击蒙版时如何关闭模态窗口extjs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我创建一个模态窗口:
If I create a modal window:
Ext.define('myWindow', {
extend: 'Ext.Container',
alias: 'widget.myWindow',
floating: true,
modal: true,
listeners:
'onMaskClick???': { close the window }
.....
}
我如何知道用户何时点击了窗口外的蒙版?在 Sench Touch 中,有一个配置 hideOnMaskTap 可以让我指定.extJS 的事件/配置是什么?
How do I know when a user has clicked on the mask outside the window? In Sench Touch, there is a config hideOnMaskTap that lets me specify. What is the event/config for extJS?
推荐答案
Tramway 的 case(有点)适用于模态或非模态窗口.但如果像组合框的边界列表这样的子组件浮动在窗口边界之外,则不会.
Tramway's case (sort of) works on modal or non modal windows. But not in case child components like the boundlist of a combobox float outside the windows boundaries.
但是,如果您无论如何都使用模态窗口,您可以像这样监听蒙版上的点击事件.
However if you use modal windows anyway you can listen for a click event on the mask like this.
Ext.define('myWindow', {
extend: 'Ext.window.Window',
alias: 'widget.myWindow',
floating: true,
modal: true,
initComponent: function () {
var me = this;
me.callParent(arguments);
me.mon(Ext.getBody(), 'click', function(el, e){
me.close(me.closeAction);
}, me, { delegate: '.x-mask' });
}
});
这篇关于单击蒙版时如何关闭模态窗口extjs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文