how to change the background color of a particular column based on its column value?
how to change the background color of a particular column based on its column value?
vaishnavkoka
Posts: 132Questions: 23Answers: 1
Here i just want to change the background color of age based on its value
for example: if the age is 28 the background color should "green" or if the age is 68 background color should be "yellow" and so on. condition is that the changes should reflect only age column-cell instead of complete row as you see in the pic
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi @vaishnavkoka ,
Yep, easily done, look at the example here,
Cheers,
Colin
@colin That example adds a background color to the entire row. @vaishnavkoka requests to only change the cell background color.
Usage of
columns.createdCell
would be more appropriate I think in this case.Here is Colin's example, edited to color a cell only.
@thanks colin and f12magic it worked.
I have got one more solution: http://live.datatables.net/cuwarezu/1/
vaishnavkoka......your solution browse this messagge
DataTables warning: table id=tabella - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3
Have a solution ?
@iceman66 , is that related to this thread?
@iceman66 , i did not re-initialized the datatable at all, please check it.
@colin you can close this thread as i got my solution.