PDA

View Full Version : [FIXED-1370] Actions don't get Container defaults



Condor
28 Oct 2010, 6:00 AM
In case of an action the defaults should be applied to the initialConfig and not to the action itself.

Example:

var win = new Ext.Window({
title: 'Hello',
width: 300,
height: 200,
buttons: [{
text: 'Button'
}]
});
var action = new Ext.Action({
text: 'Action'
});
win.fbar.add(action);
win.show();

Patch:

Ext.override(Ext.Container, {
applyDefaults : function(c){
var d = this.defaults;
if(d){
if(Ext.isFunction(d)){
d = d.call(this, c);
}
if(Ext.isString(c)){
c = Ext.ComponentMgr.get(c);
Ext.apply(c, d);
}else if(!c.events){
Ext.applyIf(c.isAction ? c.initialConfig : c, d);
}else{
Ext.apply(c, d);
}
}
return c;
}
});

It would be even better if the defaults could be applied to the object created from the action, but that's a lot more difficult to do.

meroy
3 Nov 2010, 9:34 PM
Thanks for the catch. This was added to SVN for 3.3.x.