PDA

View Full Version : Apply font color to a row grid



iNes14
9 Feb 2012, 7:08 AM
Hello !

I need something special... I have a grouping grid with records. I need, when I clicked a button, change the style of the row selected. Especially the font color. For the moment, I just managed this :

I put a boolean and test it when I load store. But in my style, I can't apply a "color", I just can apply a background color... Any idea ?



var grid = Ext.create("Ext.grid.Panel", {
scroll:true,
flex:2,
maxHeight:900,
store: sStore,
features: [groupingFeature],
pageSize: itemsPerPage,
viewConfig: {
getRowClass: function(record, index) {
var c = record.get('status');
if (c == "deleted") {
return 'ok';
}
}
}


Thank you !

Farish
9 Feb 2012, 7:57 AM
This works for me:


grid.getView().addRowCls(grid.getSelectionModel().getSelection()[0], 'redcolor');

where redcolor is the css class i want to apply:


.redcolor { color:red; !important;}

iNes14
10 Feb 2012, 5:33 AM
I have found something else :



viewConfig: {
getRowClass : function (row, index) { var cls = '';
var data = row.data;
if (data.status == "deleted"){
cls = "x-record-deleted";
}
return cls;
}


and the css :


.x-record-deleted td{
color:#727B7A !important;
}




It may help ! :)