Changing row color with ajax data
Changing row color with ajax data
Hi,
When the value of column 'status' equals 'Aanwezig', i want to color de row green, otherwise red.
Code works but as soon i replace html data with ajax it fails.
Based on these posts:
https://datatables.net/forums/discussion/36595/change-the-row-color-based-on-column-data
https://datatables.net/forums/discussion/62460/changing-row-color-at-rendering-time-based-on-column-values
Example:
http://live.datatables.net/cesevuhe/1/edit?html,css,js,console,output
Can anyone help?
Thx!
This question has an accepted answers - jump to answer
Answers
Your dat structure is objects not arrays. Use
data.status
instead ofdata[2]
, for example:Kevin
Wow thanks kthorngren!
Totally missed that, works as expected now.