PDA

View Full Version : Column -> ColumnModel - How does this code work?



chrishallowell
21 Aug 2009, 9:13 AM
How does this work? What object array is thecolumns? Is it a ColumnModel or just a column? I would have thought the commented out code was needed...



var thecolumns =[];

thecolumns.push({header :"Site", dataIndex :'Site', width :100});


thecolumns.push({header :"RecNum", dataIndex :'NumRecs', width :100});




//var colModel = new Ext.grid.ColumnModel(thecolumns);



var myGrid =new Ext.grid.GridPanel({

store : store,

columns : thecolumns,



fitcontainer : true,


height:200,



width : 280,


renderTo : 'example-grid4'

});




store.load();

myGrid.store.on('load',myGrid.autoSizeColumns,myGrid);

});

8 Sep 2009, 6:12 AM
it's an array of object that the GridPanel passes along to instantiate an instance of ColumnModel. The different objects are used by ColumnModel to instantiate instances of Columns