Changing cells font color based on a cell value
-
Hi Tobias π
I would like to change cells font color based on a cell value.
For example I have got 7 columns : on the column number 5 I have three possible words: Green, Red, and Blue.
If I have the word Green on the row number 2, I would like this cell to have his font color (and not background) green, and also the cell of the same row, column number 2.
Same for Blue and Red.
I found this code and tried to put it in the custom commands but I can’t make it work:
“aoColumnDefs”: [
{ “aTargets”: [6], “fnCreatedCell”: function (nTd, sData, oData, iRow, iCol) {
if (sData == ‘Green’) { $(nTd).css(‘color’, ‘grey’).css(‘font-color’, ‘green’); }Do you have any idea? thank you a lot! π
- The topic ‘Changing cells font color based on a cell value’ is closed to new replies.