PDA

View Full Version : GridView row class



mitchellsimoens
21 Dec 2009, 8:05 PM
I'm not sure if I'm doing this right but I want to change the background of a row depending on a record. I have it changed but it disregards the over and selected classes but I still want it to use the default over and selected classes. This is within my GridPanel:


viewConfig: {
getRowClass: function(record, index) {
var rec = record.get("unseen");
if (rec == "U") {
return "new_mail_grid_row";
}
}
}

extjs_mahendra
21 Dec 2009, 8:48 PM
using row class u can set css class for grid row
in that css u set background color

e.g.

viewConfig: {

enableRowBody:true,
showPreview:true,
//Return CSS class to apply to rows depending upon data values
getRowClass: function(record, index) {

if(record.id == 'last_row'){
return 'last_unit_grid';
}else{
if(record.data.size_accuracy == 1){
return 'accurate_css';
}else{

return 'non_accurate_css';
}

}

}
}

This is js Code



.accurate_css{
background-color:#63B672
}

.non_accurate_css{
background-color: #FF5E5E
}

This is Css code

mitchellsimoens
22 Dec 2009, 8:56 AM
Couple things,

First, use the code tags to wrap your code or the quote tags or anything. See how my code looks a million times better than yours? If you are going to help someone or ask for help, make things legible.

Second, your code isn't any different than mine. Reread my post. It's working but I'd like to keep the standard over and selected classes along with my default (nonselected and nonover class).

But thank you for at least looking and trying.