I had a problem recently while using initcomponent:
Code:
Ext.ns("APP.view");
APP.view.North = Ext.extend(Ext.Toolbar, {
initComponent : function() {
Ext.apply( this, {
region : 'north',
height : 30, // give north region a height
border : false,
margins : '0 5 0 5',
items : this.buildTbar()
});
APP.panel.North.superclass.initComponent.call(this);
},
.....
using constructor solved the problem:
Code:
Ext.ns("APP.view");
APP.view.North = Ext.extend(Ext.Toolbar, {
constructor : function(config) {
// config = config || {};
Ext.applyIf( config, {
region : 'north',
height : 30, // give north region a height
border : false,
margins : '0 5 0 5',
items : this.buildTbar()
});
APP.view.North.superclass.constructor.call(this, config);
},
.....
My question:
Are there situations where it is preferable to use initcompontent? Or is it save to say that constructor is a more safe option in any case?