Change cell css background after edit
Change cell css background after edit
Gotcha007
Posts: 13Questions: 3Answers: 0
Hi guys.
I would like to change the css background property of a cell after I edit it.
For the moment I do have my cell/column created like this:
{
"data": "db_ob_Main.Approved",
"render": function (val, type, row){
if (val == 0){
return "Not approved";
}else{
return "Approved";
}
},
"fnCreatedCell": function(nTd, sData, oData, iRow, iCol){
if(sData == 0){
$(nTd).css('background-color', 'red');
}else{
$(nTd).css('background-color', 'green');
}
}
}
It's working well at the creation and match the color but after I edit, the background color stays the same...
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You need to use
rowCallback
for this at the moment, and modify the cell in the row. There isn't currently anupdatedCell
callback (yet).Allan
Works perfectly! Thanks a lot!