How to close modal window extjs when clicking on mask?

前端 未结 4 1168
遇见更好的自我
遇见更好的自我 2021-02-05 16:19

If I create a modal window:

Ext.define(\'myWindow\', {
    extend: \'Ext.Container\',
    alias: \'widget.myWindow\',
    floating: true,
    modal: true,
    li         


        
4条回答
  •  太阳男子
    2021-02-05 16:36

    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' });
        }
    });
    

提交回复
热议问题