Use rowCallBack with moment.js

Use rowCallBack with moment.js

krizenkrizen Posts: 6Questions: 2Answers: 0
edited February 2017 in Free community support

Hello,

Sorry if that's not clear, I'm not a native speaker.

I'm trying to display background-color on a row with rowCallBack and moment.js

If the date in a cell is before the actual date the row get colored.

Is that possible?

Here is what I tried:

$(document).ready(function() {
  var date = moment().format('DD-MM-YYYY') 

  $('#dataTable').dataTable({
    retrieve: true,
    "rowCallBack": function(nRow, data, index){
      if (moment(data[5]).isBefore(date)) {
        $('td:eq(5)', row).css('background-color', 'red')
      }
    }
  })
});

Answers

This discussion has been closed.