Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close modal window extjs when clicking on mask?

If I create a modal window:

Ext.define('myWindow', {
    extend: 'Ext.Container',
    alias: 'widget.myWindow',
    floating: true,
    modal: true,
    listeners:
        'onMaskClick???': { close the window }
    .....
}

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?

like image 480
johnstoecker Avatar asked Sep 14 '12 12:09

johnstoecker


1 Answers

You can try this also:

Ext.getBody().on('click', function(e, t){
    var el = win.getEl();

    if (!(el.dom === t || el.contains(t))) {
        win.close();
    }
});
like image 147
Aminesrine Avatar answered Sep 25 '22 02:09

Aminesrine