PDA

View Full Version : Hide Ext.window on loose focus



imoise
2 Dec 2009, 12:13 AM
Hy, I'm just wondering is there a way to hide a Ext.Window when you click outside the window? I've looked around but fount nothing similar .

husniadil
2 Dec 2009, 1:39 PM
try this



<script type="text/javascript">

function showWindow() {
var win = new Ext.Window({
width: 400,
height: 300,
modal: true,
title: 'Hello',
bodyStyle: 'padding: 10px; font-size: 16px; font-weight: bold',
html: 'click in any place outside the window',
listeners: {
show: function() {
Ext.select('.ext-el-mask').addListener('click', function() {
win.close();
});
}
}
});
win.show();
}

</script>
<a href="#" onclick="showWindow();">Click here</a>

CrazyEnigma
2 Dec 2009, 3:10 PM
There is a deactivate (http://www.extjs.com/deploy/dev/docs/source/Window.html#event-Ext.Window-deactivate) event on window.

Not too sure if this helps.

husniadil
3 Dec 2009, 9:27 AM
How about this?


function showWindow() {
var win = new Ext.Window({
width: 400,
height: 300,
modal: true,
title: 'Hello',
bodyStyle: 'padding: 10px; font-size: 16px; font-weight: bold',
html: 'click in any place outside the window',
listeners: {
show: function() {
Ext.select('.ext-el-mask').addListener('click', function() {
win.close();
});
}
}
});
win.show();
}



<a href="#" onclick="showWindow();">Click here</a>

milestonebass
25 Feb 2010, 3:52 PM
Only works for modal windows, of course.
How would you suggest the same functionality for a non-modal window?

pravnviji
21 Jan 2016, 6:09 PM
hideOnMaskTap:true,
listeners : {
hide: function() {
this.destroy();
}
},