Добавьте этот скрипт.
<script>
$(document).ready(function() {
var table = $('#customer_listing').DataTable({
columnDefs: [
{ targets: 4, width: '100px' }
],
createdRow: function(row, data, dataIndex){
$('#customer_listing tr td:nth-child(5)').addClass(function() {
var status = parseInt($(this).text(), 10) || 0;
var qty = parseInt($(this).prev('td').text(), 10) || 0;
return status < qty ? 'green' : status > qty ? 'red' : 'red';
});
}
});
});
</script>
и удалите этот
$(function() {
$('#customer_listing tr td:nth-child(4)').addClass(function() {
var status = parseInt($(this).text(), 10) || 0;
var qty = parseInt($(this).prev('td').text(), 10) || 0;
return status > qty ? 'red' : 'green';
});
});