I have problem with datatables. Until now, I use them with a lot of data. I have build two checkboxes for negative values and positive values like this:
<label id="mf123_filter">
<input type="checkbox" id="filterP">Positive Growth
</label>
<br>
<br>
<label id="mf123_filter">
<input type="checkbox" id="filterN">Negative Growth
</label>
On JS I implement an on.change function to exclude or include negative or positive values. The code is here:
$('#filterP').on('change', function () {
if ($(this).is(':checked')) {
$.fn.dataTable.ext.search.push(
function (settings, data, dataIndex) {
return parseFloat(data[-2]) > 0 //PROBLEM
}
)
} else {
$.fn.dataTable.ext.search.pop();
}
graph2Table.draw();
});
My problem is that datatables does not recognize the negative index (data[-2]). Is there any way to target the second column from the end?