I am using Dojo 1.10, have a simple dojox.grid.DataGrid, and want to change the background color as well as font color based on data.
I wrote a onStyleRow function myStyleRow(row){ var item = grid.getItem(row.index); if(!item) return;
var mappingFlag = store.getValue(item, "flag", null);
var mappingId = store.getValue(item, "matched_mapping_id", null);
if(mappingFlag == 0){
row.customStyles += " color:black;";
}else if(mappingFlag == 1){
row.customStyles += " color:gray;";
}else if(mappingFlag == 2){
row.customStyles += " color:red;";
}else if(mappingFlag == 3){
if(mappingId == currentMappingId){
row.customStyles += " color:blue; background-color:#fff000;";
}else{
row.customStyles += " color:blue; background-color:#ffffff;";
}
}
grid.focus.styleRow(row);
grid.edit.styleRow(row);
}
What drive me to chaos is that the font color (blue/red/gray) are well set and displayed, but the background color does not take any effect...
What's wrong to my code? how I can change the row background color?
Many thanks!