text color in column

text color in column

smicrozsmicroz Posts: 3Questions: 0Answers: 0

Hi,

I trying to change a color of text in one column if certain conditions are met. In the column the data type are Number, then if greater than 0 color green and if smaller than 0 color red.

To do this usually I set class in the <td class="changeColor"></td> and with Jquery / Lodash

$('.changeColor').each(function(){

if($(this).text() > 0){
$(this).css('color', 'green);
}else if($(this).text() < 0){
$(this).css('color', 'red');
}
})

In my datatable I have 50 entries, but this code only select 30 items.

Any suggestion?

Thanks

Replies

This discussion has been closed.