PDA

View Full Version : ExtJS inheritance



peterpaul12
22 Feb 2010, 8:34 AM
Hi,

I am stuck with inheritance or javascript?! :(

I have one class which inherits from GridPanel.
My second class should inherit from my first class.
In my first class i define columns which I want to accesss within my second class. But if i am trying to do so the columns
var is undefined (see code below).

What am i missing?


Thx
peterpaul




MyFirstGrid
= Ext.extend(Ext.grid.GridPanel, {

constructor:function(config) {

Ext.applyIf(this, {
config: config
});
MyFirstGrid.superclass.constructor.apply(this, arguments);

},

initComponent: function() {

this.columns = [{id:1, ....}, {id:2, ....}];
//call parent
MyFirstGrid.superclass.initComponent.apply(this, arguments);

}


});




MySecondGrid
= Ext.extend(MyFirstGrid, {

constructor:function(config) {


Ext.applyIf(this, {
config: config
});
MySecondGrid.superclass.constructor.apply(this, arguments);

},

initComponent: function() {

//call parent
MySecondGrid.superclass.initComponent.apply(this, arguments);


/*??? ACCESS COLUMNS ????
this.columns = undefined?*/

}

});

22 Feb 2010, 9:06 AM
if memory serves, the ColumnModel is already instantiated, thus columns is deleted!

peterpaul12
23 Feb 2010, 12:08 AM
Hi,

thx jgarcia! That's it!

Now i can access the column model and the column model configuration by



this.colModel
this.colModel.config


sers
peterpaul