Working on data tables and everything seems great. I am using the rowGroup and it works great and showing me the grouping properly. Also using startRender to find and show group vice calculations.
My problem is that pagination affects my calculations; if display length is set to 10, and a group have 17 rows, in start render calculation it gives the calculation result of first 10 rows in page one and calculation remaining 7 in next page.
1) Either I want to make the calculations irrespective of page, it is needed the calculation done in the all 17 rows under that group
2) OR I need to adjust pages based on groups. that is group 1 on page 1, group 2 on page 2 and so on..
var data_table = $('#myTable').DataTable( {
order: [[0, 'asc'], [1, 'asc']],
"displayLength": 25,
rowGroup:{
dataSrc: [0, 1],
startRender: function ( rows, group ) {
var clickTotal = rows
.data()
.pluck(3)
.reduce( function (a, b) {
return parseInt(a) + parseInt(b);
});
var ageCTR = rows
.data()
.pluck(5)
.reduce( function (a, b) {
return parseInt(a) + parseInt(b);
});
return $('<tr>')
.append( '<td>'+group+'</td>' )
.append( '<td>'+clickTotal+'</td>' )
.append( '<td>'+ageCTR +'</td></tr>' );
}
},
columnDefs: [ {
targets: [ 0, 1,5 ],
visible: false
},
{ orderable: false, targets: [2,3,4] } ],
} );