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>