Change text color based on value
Change text color based on value
dabaq
Posts: 6Questions: 3Answers: 0
I'm trying to work out some conditional formatting for column 4 and 5, based on these criteria:
if value <= 0, color here
if value => 1, color here
if value => 2, color here
if value => 3, color here
if value => 4, color here
if value => 5, color here
I've read I need to use rowcallback in order to use this, but I can't get my head around it.
Best regards
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
If its just the text colour, use a renderer and put it in a
span
with the correct colour for the value.Allan
Thank you for your reply Allan. However I have no idea how to do that, I'm very new to this. Could you point me in the right direction? I thought I could get away with a simple if else statement.
Maybe this example will help:
http://live.datatables.net/sifukito/1/edit
Kevin
Thanks Kevin, that's what I was looking for.
@kevin, how to change color for two columns which have different values, say column 5 has Yes/No and column 7 has Locked/Unlocked. thanks
Is there a way that I can put the color in it's specific <td> ?
I want to avoid putting the <span> tag cause it'll blow other script that I have.
I wish to highlight the 'Waiting definition' value in a specific column and I think that if I could add the class above in <td>s that have this value it'd be perfect
.redText {
color:#F00 !important;
}
Hi @Serenna ,
Yep, see this example here.
Cheers,
Colin
Thank you very much!