DataTables count per group

0

Has anyone managed to do a row count per group with dataTables?

Considering this structure:

$('#tabela').DataTable({
        "lengthChange":false,
         "pageLength": 500,
         "filter":true,
         "responsive":true,             
             "columnDefs": [
                    { "visible": true, "targets": 2 }
                ],
                "order": [[ 2, 'asc' ]],
                "displayLength": 100,       
                "drawCallback": function ( settings ) {
                    var api = this.api();
                    var rows = api.rows( {page:'current'} ).nodes();
                    var last=null;

                    api.column(2, {page:'current'} ).data().each( function ( group, i ) {

                        if ( last !== group ) {
                            $(rows).eq( i ).before(
                                '<tr class="group"><td colspan="5">'+group+'</td></tr>'
                            ); 
                            last = group;
                        }//end if

                    });//end api_column

                }//end func settings        

    });//end dataTable
    
asked by anonymous 23.01.2018 / 19:22

0 answers