How to group rows in table with DataTable

1

I am trying to group the rows of a table generated with DataTables and Ajax, but I can not get them to be grouped. I need to group them by the Activity column. The table that is currently generated is the following:

The JavaScript code I am using is:

function gridView(fechaDesde, fechaHasta) {

    var table = $('#gridView').DataTable({
        "ajax": "/IndicadorServicio/IndicadoresClientesVip/GetIndicadoresClientesVip/?fechaDesde=" + fechaDesde + "&fechaHasta=" + fechaHasta,


        "columns": [
            { "data": "Actividad" },
            { "data": "SlaIndicadores" },
            { "data": "VolumenOk" },
            { "data": "VolumenTotal" },
            { "data": "Cumplimiento" },
            { "data": "Estado" }
        ],
        'rowsGroup': [0],
        "columnDefs": [
            {
                "searchable": false,
                "sortable": false
            }
        ],
        "iDisplayLength": 15,
        "aLengthMenu": [
            [15, 20, 25, 30, -1],
            [15, 20, 25, 30, "All"]
        ],

    });

    return table;
}

I'm using 'rowsGroup': [0] but I have not succeeded.

    
asked by Kerepakupai 24.10.2017 в 20:35
source

1 answer

1

The code was fine, only the small detail of adding the library was missing:

<script src="//cdn.rawgit.com/ashl1/datatables-rowsgroup/v1.0.0/dataTables.rowsGroup.js"></script>

Now it works perfect.

    
answered by 25.10.2017 / 16:31
source