footerCallback not working for a few columns
footerCallback not working for a few columns
DingusAmongus
Posts: 7Questions: 3Answers: 0
So I have footerCallback working and showing the totals for some columns, but for other columns that have a colspan header above them, I am getting an error:
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'toFixed'
In the @section scripts:
function setFooterCell(row, colNum, total) {
var TotalCells = row.getElementsByTagName('th');
TotalCells[colNum].innerHTML = total.toFixed(2);
The error highlights this part of the code:
earningsAmountTotal = api
.column(16)
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
});
setFooterCell(row, 5, earningsAmountTotal);
deductionsCurrTotal = api
.column(18)
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
setFooterCell(row, 6, deductionsCurrTotal);
});
I'm guessing the issue is that those columns are actually grouped under a colspan header? Please excuse the formatting, I am somewhat new to the ways of the force.
This discussion has been closed.
Answers
What does the debugger show the value of 'total' parameter as it is passed into setFooterCell.
In my code, where I'm summing columns, I have this
You are missing that 0 parameter.
Another member of the team figured out a fix, but thanks for the help ThomD!