I have a problem that I have not been able to solve. I have a table with 3 columns.
Nombre | Nota | Rango |
-------------------------------
Pepe | 5 | Excelente
María | 3 | Bueno
Luis | 1 | Malo
I want the cell to be green if it is excellent, if it is good blue and bad red, but it is painting the whole row and I want it to paint only the cells of the rank column. I have this code.
$(document).ready(function(){
$('#mitabla').DataTable({
"scrollX": true,
"rowCallback": function( Row, Data) {
if ( Data[2] == "Excelente" )
{
$('td', Row).css('background-color', 'Green');
}
else if ( Data[2] == "Bueno" )
{
$('td', Row).css('background-color', 'Blue');
}
else if ( Data[2] == "Malo" )
{
$('td', Row).css('background-color', 'Red');
}
},
What I want to do is possible?