I'm using AJAX to remove specific rows from jQuery Datatable. These rows have value 0 in the 10th column (if we start counting from 0). Below you can see my code. For some reason, it does not remove any row. I checked the value of aData[10] => it is definetely equal to 0 in some rows.
$(document).ready(function(){
$('#newspaper-b').dataTable({
"sPaginationType":"full_numbers",
"aaSorting":[[4, "asc"]],
"aoColumns": [null,null,null,null,null,null,null,null,null,null,
{"bSearchable": true, "bVisible": false},null,null],
"bJQueryUI":true,
'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
if(aData[10]=="0"){
$(nRow).remove();
}
return nRow;
}
});
UPDATE
When I do this:
'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
var r=confirm(aData[10]);
if (parseInt(aData[10], 10) === 0) {
$(nRow).remove();
}
return nRow;
}
...then I can see that one of rows has 0. But when I do this:
'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
if (parseInt(aData[10], 10) === 0) {
var r=confirm(aData[10]);
$(nRow).remove();
}
return nRow;
}
...then alert JS message (i.e. var r=confirm(aData[10])
) does not appear, which means that IF statement returns false. BUT WHY???
![enter image description here][1]