createdCell

createdCell

deliatordeliator Posts: 95Questions: 1Answers: 0

hello,

This worked really fine :

$('#example').dataTable( {
  "columnDefs": [ {
    "targets": 3,
    "createdCell": function (td, cellData, rowData, row, col) {
      if ( cellData < 1 ) {
        $(td).css('color', 'red')
      }
    }
  } ]
} );

But when i select a row (with red style) blue background with red text are not clearly readable ...
Is there a way to change de text of my red text to white for example ?

Thanks,

Marc

Replies

  • allanallan Posts: 63,791Questions: 1Answers: 10,513 Site admin

    Hi Marc,

    I'm afraid I don't quite understand. If you want the text white rather than red, just change 'red' to 'white'. Or is it that you want the colour to change when selected? If so, I would suggest that you add a class to the cell rather than using $().css() and then in your stylesheet setup suitable rules.

    Allan

This discussion has been closed.