View Full Version : [FIXED][3.0] relayEvents disables events

3 Apr 2009, 1:21 AM
The current relayEvents method inadvertently disables already registered event handlers.

Create a FormPanel with an actioncomplete listener.
The addListener call will initialize events['actioncomplete'] (set it to an Ext.util.Event instance).
The relayEvents call to relay beforeaction, actioncomplete and actionfailure events from the BasicForm will toggle events['actioncomplete'], setting it to false.


Ext.override(Ext.util.Observable, {
relayEvents: function(o, events){
var me = this;
function createHandler(ename){
return function(){
return me.fireEvent.apply(me, [ename].concat(Ext.toArray(arguments)));
Ext.each(events, function(ename){
me.events[ename] = me.events[ename] || true;
o.on(ename, createHandler(ename), me);

3 Apr 2009, 6:45 PM
Fixed in SVN.

6 Apr 2009, 6:45 PM
Ah, great. I fixed this a while back by copying over the code from v2.2.

Note that
o.on(ename, createHandler(ename), me); can be shortened to
o.on(ename, createHandler(ename)); since me is used instead of this and it references inside the closure. A big three bytes, but it would be nice if I didn't have so many files marked as changed from the svn trunk! Thanks!