PDA

View Full Version : How to change color background in metachange event



tdikarim
22 Apr 2011, 4:08 AM
Hi all,

I use metadata for load a grid
How can I change the background color in metachange event

I have tried the solution describe by this post :
http://www.sencha.com/forum/showthread.php?127749-Change-background-color-of-the-grid-column&highlight=background+column

But my grid become empty.



listeners: {
metachange: function(store, meta){
var grid = Ext.getCmp('TKdynamiqueGrid');
var cm = grid.getColumnModel();

cm.setConfig(meta.colModel);
grid.reconfigure(store, cm);

grid.render();
grid.getBottomToolbar().render();
grid.getColumnModel().setRenderer('RSH_COL', renderBackgroundRed);
grid.getView().refresh();
}
}





function renderBackgroundRed(value, metadata, record, rowIndex, colIndex, store)
{
metadata.attr = 'style="background-color: red;"';
return value;
}


Thanks for your help