I was wondering if there was a way in the data grids to have a footer in the Group By?
Meaning instead of doing the sum of all the columns for the whole report only do the sum for the columns in each group?
DataTables::create([
'name' => 'rowGroupTable',
'dataStore' => $this->dataStore('result'),
'plugins' => [
'Buttons',
'FixedColumns',
'FixedHeader',
'KeyTable',
'Responsive',
'RowReorder',
'Scroller',
'SearchPanes'
],
'options' => [
'dom' => 'Blfrtip',
'buttons' => [
],
'searching' => true,
'paging' => true,
'pageLength' => 100,
'order' => $this->params['order'],
'fixedHeader' => true,
'autoWidth' => false,
'columnDefs' => [
$width
],
],
'clientRowGroup' => [
'groupby' => [
'direction' => 'asc',
'top' => '<td colspan="999">{expandCollapseIcon} ' . $groupbyTitle . ': {groupby}</td>',
],
],
'cssClass' => [
'table' => 'table table-bordered table-striped table-hover'
],
'columns' => $columns,
'showFooter' => $this->params['sum'],
'fastRender' => true,
'onReady' => 'function() {
arr = getOrderBy();
rowGroupTable
.order(arr)
.draw();
checkRecordCount();
}',
]);
Here is our code snippet for how we handle our group by data table.
This Picture shows the general Idea of what we want.