PDA

View Full Version : headerCtCfg is undefined while implementing Ext.grid.header.Container



Srikanth474
29 Feb 2012, 12:02 PM
Hi,

My existing application is using extjs 2. i am upgrading it to extjs 4. i have a grid which is using Ext.grid.ColumnModel.

sample code:
var gridColumnModel = new Ext.grid.ColumnModel([
{width:160, header:'header1', dataIndex:"timeStamp", sortable:true, allowsearch:false},
{width:60, header:'header2', dataIndex:"tableName", sortable:true, allowsearch:false}
]);
var sampleGrid = new Ext.grid.GridPanel({
layout: 'fit',
region: 'center',
monitorResize: true,
ds: gridDataStore,
cm: gridColumnModel,
autoExpandColumn: 'updateDescription',
ctCls: 'cvmBusStructUpdateHistoryGrid',
stripeRows: true,
viewConfig: { forceFit: false},

});


In extjs 4 i believe Ext.grid.header.Container is the alternative for the columnModel

so i tried to implement it this way:

var gridColumnModel = new Ext.grid.header.Container([
{width:160, header:'header1', dataIndex:"timeStamp", sortable:true, allowsearch:false},
{width:60, header:'header2' , dataIndex:"tableName", sortable:true, allowsearch:false}
]);

Ext.define('TestingGrid', {
extend:'Ext.grid.Panel'
,alias:'widget.test1',
bodyPadding: 0, // Don't want content to crunch against the borders
// width: 700,
//anchor:'10%',
width:'100%',
height: '100%',
columnLines: true //INITCOMPONENT
,store: Ext.data.StoreManager.lookup('testStore')
,cm:gridColumnModel,
// RELOADGRID
reloadGrid : function() {
this.store.reload();
}


}); // eo Define

But i am getting below error in Firebug

headerCtCfg is undefined



me.columns = headerCtCfg.items;




Can anyone please tell me how should this be implemented.

Thanks in Advance,
Srikanth

mitchellsimoens
29 Feb 2012, 12:24 PM
Look at the grid examples, you specify the columns config in the grid to an array of column config objects

Srikanth474
29 Feb 2012, 12:52 PM
can you tell me which example to look for. i did not find any example which implements column model

thanks

mitchellsimoens
29 Feb 2012, 1:02 PM
Forget column model, there isn't a such thing anymore. You simply specify the columns config on the grid to an array of column config objects.

Srikanth474
29 Feb 2012, 1:08 PM
i found the example thank you

oneofakind007
23 Sep 2012, 5:19 PM
can you share the link of your example?