, endRender: function (rows, group)
{
var tQty = rows
.data()
.pluck(3)
.reduce(function (a, b) {
return a + b.replace(/[^\d]/g, '') * 1;
}, 0) ;
var tAcc = rows
.data()
.pluck(4)
.reduce(function (a, b) {
return a + b * 1;
}, 0) ;
var tRej = rows
.data()
.pluck(5)
.reduce(function (a, b) {
return a + b * 1;
}, 0);
var tDiff = rows
.data()
.pluck(6)
.reduce(function (a, b) {
return a + b * 1;
}, 0);
var tYield = 0;
if (tAcc != 0 && tRej != 0 && tDiff != 0 )
{
tYield = tAcc / (tAcc + tRej + tDiff ) * 100;
tYield = $.fn.dataTable.render.number('', '.', 2, '').display(tYield);
}
return $('<tr/>')
.append('<td colspan="3" align="center" >' + group + '-TOTAL: ' + '</td>')
.append('<td align="right">' + tQty + '</td>')
.append('<td align="right">' + tAcc + '</td>')
.append('<td align="right">' + tRej + '</td>')
.append('<td align="right">' + tDiff + '</td>')
.append('<td align="right">' + tYield + '</td>')
}
, dataSrc: [1]
I want to calculate running totals or say some calculations based on grouped rows . i.e first row of the current group and last row of the current group.. how to do it?