Is it possible to addClass to render.number
Is it possible to addClass to render.number

Hi!
I'm trying to add a row with a calculated value and add a class depending on that value, but can't get the addClass to work.
I'm learning so any help is much appreciated!
"data": null,
"render": function ( td, data, type, row ) {
var sum = data.price - data.prepaid;
if ( sum = 0 ) {
$(td).addClass('green');
} else {
$(td).addClass('red');
}
return $.fn.dataTable.render.number(',', '.', 2, '€ ').display(sum);
}
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You would use
createdCell
to add the class. You will have both thecreaetdCell
andrender
options. Something like this:Kevin
That did the trick!!
Sanx Kevin!