Just started working with JS BS Datatables, wondering if this is the correct approach for using parseInt in an if else statement?
$(document).ready(function() {
$('#myTable').DataTable({
"order": [],
"columnDefs": [{
"targets": 'nosort',
"orderable": false,
}],
"fnRowCallback": function(nRow, aData) {
if (parseInt(aData[7].innerHTML,10) <= 30) {
$('td', nRow).css('background-color', 'Red');
} else if (aData[2] >= "30" && aData[2] < "50") {
$('td', nRow).css('background-color', 'Green');
}
}
});
});
As seen in my code, I'm attempting to convert the value of row aData[7] to an integer within the statement.