The Ext.Base->initConfig method can be used to initialize configuration for a given class. However there is a problem in the implementation which I don't quite know whether it is a bug in that function or an inconsistency elsewhere in the framework. So here is an example:
Code:
Ext.define('MyWindow',{
extend:'Ext.window.Window',
alias:'widget.mywindow',
config: {
layout:'fit',
width:200,
height:200,
title:'MyWindow',
items:{
xtype:'button',
text:'Uber Button'
}
},
constructor:function(config) {
var me = this;
me.initConfig(config);
me.callParent(arguments);
}
});
In the example above, the code fails since initConfig will ultimately call "setLayout" as in setting a property called "layout", passing 'fit' (as a string), but deep in the component chain (AbstractContainer) there is already a function called "setLayout" which breaks since it needs an object (a fit layout object) instead of a "fit" as string.
So where is the problem here you might ask? Should we fix the initConfig to check if we already have a function called "setXYZ" that is not a property setter or fix the "setLayout" function in the AbstractContainer?
But wait... there is more....
I can point to several other cases like this, for example "setProxy" and any other conbination where we can find a setXYZ function for a XYZ config.
Any thoughts?