PDA

View Full Version : Error when using initComponent



auphali
31 Aug 2013, 2:48 PM
Here's a simple code i make using Ext 4.2.1 Open source version



Ext.define('roleGrid',{
extend: 'Ext.grid.Panel',
ggi: null,
store: Ext.create('roleStore'),
columns: [
{text:'Start Date',dataIndex:'start_date',
editor:{
xtype: 'datefield',
format: 'M-Y'
}
},
{text:'Position',dataIndex:'pos_id',
editor: {
xtype: 'combo',
store: new Ext.create('positionStore'),
displayField: 'displaytext',
valueField: 'value'
}
},
{text:'Work Status',dataIndex:'work_status'},
{text:'Require TLS?',dataIndex:'req_tls'},
{text:'Well Control',dataIndex:'well_control'}
],
tbar:[
{xtype:'button',text:'New'},
{xtype:'button',text:'Delete'}
],
initComponent: function(){},
insertRow: function() {
debugger
}
});


You see that there is the initComponent there, whether I fill it with anything or leave it blank, as long as i use initComponent, i always get this error on Chrome (I am using version 28) like this:
Uncaught TypeError: Cannot read property 'items' of undefinedext-all.js:21 (http://localhost:8080/resource/extjs/ext-all.js)
anyone knows why?

evant
31 Aug 2013, 4:38 PM
You never call the superclass initComponent method:



initComponent: function() {
this.callParent();
}

auphali
1 Sep 2013, 1:24 AM
My bad, that's right. Thanks a bunch