I would like to count number of rows whose value in a particular column matches. See Code below:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var refreshAlertTable = $('#alert-table').dataTable( {
"bInfo": false,
"sAjaxSource": 'ajax/alert_json.xml',
"bServerSide": true,
"bJQueryUI": true,
"bLengthChange": false,
"bPaginate": false,
"bFilter": false,
"aaSorting" : [[2, "desc"]],
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
if ( aData[2] == "5" )
{
$('td', nRow).css('background-color', 'Red');
console.log(aData.length);
}
else if ( aData[2] == "4" )
{
$('td', nRow).css('background-color', 'Orange');
console.log(aData.length);
}
},
});
setInterval (function() {
refreshAlertTable.fnDraw();
}, 5000);
} );
</script>
The first console log shows 3 circled and 5 but the actual count for that match is 3. The second console log shows 2 circled and 5 but the result should be 2. How can I retrieve just the circled values