PDA

View Full Version : Listen to Events from other Components



alexpetri
12 Nov 2009, 7:17 AM
Hi i have two Components i.e. two Windows.
If i do a maximize on the first window - the sencond window should do something - by an Event. the event is fired but the other window doesnt listn to it. Can someone explain where the problem is?

here is my code:

var win = new Ext.Window({

title: 'Window 1',
id: 'win1',
maximizable: true,
collapsible: true,
height: 400,
width: 300,
autoScroll: true,
items: {
xtype: data.xtype,
data: data
},
listeners: {
'maximize': function(){
this.fireEvent('specialEvent');
console.log('specialEvent fired');
}
}
}).show();
var otherWin = new Ext.Window({

title: 'Other Window',
id: 'win 2',
maximizable: true,
collapsible: true,
height: 400,
width: 300,
autoScroll: true,
items: {
xtype: data.xtype,
data: data
},
listeners: {
'specialEvent': function(){

console.log('i received a specialEvent');
}
}
}).show();

jay@moduscreate.com
12 Nov 2009, 8:17 AM
? i don't think you get the point of events with the framework.

jay@moduscreate.com
12 Nov 2009, 8:18 AM
http://www.extjs.com/learn/Tutorial:Events_Explained

If the above post is not enough, then I'd like to suggest my book (see my sig)

alexpetri
12 Nov 2009, 9:24 AM
thank you for your reply .. indeed im not very familiar with events and listeners.
But the question is if i can realize this "inter-component" comunication as i described it.
I found a tutorial about relayEvents http://www.extjs.com/learn/Tutorial:RelayEvents mybe thats it.