PDA

View Full Version : How to catch a click ON a window ?



Elfayer
6 Aug 2012, 5:10 AM
Hi,

I tried this :


win.getEl().on('click', function (cmp) {
alert("toto");
}, this);


But that only alert when I click on the borders on the window.

Farish
6 Aug 2012, 5:22 AM
try this:


window = Ext.create('widget.window', {
defaults:
{
listeners:
{
itemclick: function() {alert('click');}
}
}
});

friend
6 Aug 2012, 5:24 AM
There must be some other issue at play. Your code sample works for me as expected using ExtJs v4.1.1 on FireFox 13.0.1, Chrome 21.0.1180.60 and IE 9.0.8112.16421.

What child components are configured for the target window?

Elfayer
6 Aug 2012, 5:59 AM
try this:


window = Ext.create('widget.window', {
defaults:
{
listeners:
{
itemclick: function() {alert('click');}
}
}
});

Doesn't work.


There must be some other issue at play. Your code sample works for me as expected using ExtJs v4.1.1 on FireFox 13.0.1, Chrome 21.0.1180.60 and IE 9.0.8112.16421.

What child components are configured for the target window?
There is only an html Iframe.

friend
6 Aug 2012, 6:10 AM
I'm willing to bet that it's the iframe causing the issue. As a simple test, comment the iframe and see if the click event is captured correctly.

Elfayer
6 Aug 2012, 6:25 AM
Yes, that it, without the Iframe it's working... =(

Can I do something about it?

friend
6 Aug 2012, 10:55 AM
I think you can register a click handler on the iframe, though I've never tried this before and it's possible it might end up causing other issues, depending on the contents of the iframe.