PDA

View Full Version : Overriding default members when using extended class



AndreKR
29 Apr 2010, 7:13 PM
Hello,

I have a TabPanel with several similar tabs:


xtype: 'tabpanel',
items: [
{
xtype: 'componentlist',
title: 'Semiconductors',
},
{
xtype: 'componentlist',
title: 'Regulators',
},
]Each tab contains a grid and has roughly the same functionality, that's why I created a subclass for them:


componentlist = Ext.extend(Ext.Container, {
initComponent: function() {
Ext.apply(this, {
layout: 'fit',
items: {
xtype: 'grid',
store: new Ext.data.ArrayStore({fields: [
{name: 'part_number'},
{name: 'package'},
]}),
colModel: new Ext.grid.ColumnModel([
{header: 'Part Number', sortable: true, dataIndex: 'part_number'},
{header: 'Package', sortable: true, dataIndex: 'package'},
]),
}
});
componentlist.superclass.initComponent.apply(this, arguments);
}
});My questions:

I want a few tabs to have a different colModel. What is the best way to do this?

Where is the best place to call loadData(dummy_data) to populate the grid with some data?

Regards,
André