PDA

View Full Version : Change row color on render function @ grid



avalverde
23 Jul 2009, 1:54 PM
Hi , I'm looking for a solution to change the color of the row inside the render function, I already figured out how to change the cell color, but I'm not able to apply the same concept to the row.

Thanks

tryanDLS
23 Jul 2009, 3:17 PM
http://extjs.com/learn/Ext_FAQ_Grid

Kenye2000
14 Jan 2015, 6:37 PM
Here is what I got for sencha touch 2 :

this renderer is for grid xtype column :

renderer: function(value, record, rowIndex) {
var index = Ext.getCmp('YourGridID').getStore().indexOf(record) + 1;
var element = Ext.get('ext-gridrow-'+index);

if(element){
var myClassName = 'green'; //your css class here, I used green as background
element.removeCls(myClassName);
if (value !== null ) { //do your checking of the field value
element.addCls(myClassName);
}
}
return value;
}


Let me know if this helps / works for anyone else, good luck!