Row grouping

Row grouping

RicardoVRicardoV Posts: 1Questions: 1Answers: 0

Hello,

I am using the Row grouping example to group rows by weeks. I was wondering if it was possible to add a column at the bottom of the group to count that group row.

My code:

drawCallback: function (settings) {
    var api  = this.api();
    var rows = api.rows({page: 'current'}).nodes();
    var last = null;

    api.column(weekColumn, { page: 'current' }).data().each(function(group, i) {
        if (last !== group) {
            $(rows).eq(i).before('<tr><td colspan=" ' + weekColumn + ' ">{{ trans('admin.worktime.field.week') }} ' + group + '</td></tr>');
            last = group;
        }
    });

    api.column(weekHourColumn, { page: 'current' }).data().each(function(group, i) {
            $(rows).eq(i).after('<tr><td colspan="5">' + group + '</td></tr>');
    });

    drawDataTable(this);
}

Instead, after every row, that specific weekHourColumn is been calculated. Instead I just want one big row with that number.

Hopefully somebody can help me or advise me.
Thanks.

This discussion has been closed.