I have and Ext JS 4.2 grid that has to change based on the Metadata and all works well except when a column has a renderer. Is it even possible to have the renderer created at this time. Here is basically what I am trying to do
function metaChanged(store,meta){
var grid = Ext.ComponentQuery.query('#mainItemGrid')[0];
grid.reconfigure(store,meta.columns);
var colPosition = 0;
Ext.each(meta.columns,function(col){
if (col.renderer !== undefined){
switch(col.dataIndex){
case 'chgflag':
var myCol = grid.columns[colPosition];
var f = function(value,metaData,record,rowIndex,colIndex,store,view){
return Ext.String.format("<img src='_images/{0}", record.data.chgflag);
};
myCol.renderer = f;
break;
}
}
colPosition++;
}, this);
}
I have only added one renderer type to the switch statement but there will be multiple types of renderers that I will need to create so yes, I know it looks a little silly to have only one case in a switch statement. any help would be greatly appreciated. I have also tried having the reconfigure statement after the enumerations of the columns but no luck so far.