0
我已经使用jquery datatable在表中显示我的数据。所有工作正常我只是有一个问题。我的桌子上有显示有效的列&非活动客户。我想对有效的&非活动客户进行计数,因为我有以下脚本。在这里,我试图计算每行中具有活动值的行,但它计算了总行数。计数在jQuery数据表中具有特定值的行
<script type="text/javascript">
$(document).ready(function() {
$('#example').dataTable({
"bLengthChange": true,
"paging": true,
"sPaginationType": "full_numbers" , //For Different Paging Style
"scrollY": 400, // For Scrolling
"jQueryUI": false, //Enabling JQuery UI(User InterFace)
"lengthMenu": [[30, 50, 100, -1], [30, 25, 50, "All"]],
drawCallback: function (settings) {
var api = this.api();
// get the number of rows, but remove the page:current if you want number of rows in entire dataset
var count = api.rows({
api: $('#example tbody tr td[value="active"]')
}).data().length;
// this takes the count and appends it in a span tag to the dataTables pageinate div element
$('<span id="active_rows"></span>').html(count + ' rows').appendTo($('.dataTables_info'));
}
});
});
</script>