Hello.
I've a column for each week of the year containing different numbers. So when each column renders I do a sum for that column in the footer. But I also would like to do a sum for that column and 3 months ahead (this + 11 columns ahead) for each column.
footerCallback: function () {
var api = this.api();
api.columns('.sum', {
page: 'current'
}).every(function (index) {
var sum = this.data().sum();
// How should I do this instead of referencing the table again? Or is this OK?
// I cannot reach the table variable created when creating the DataTable in document ready.
var table2 = $('#assignmentReport').DataTable();
for (var i = index; i <= index + 11; i++) {
var s = table2.column(i).data().sum();
console.log(s)
}
});
}
The problem with this solution is that it continues for 11 weeks the last week 52 also, so it throws an error:
Cannot read property 'sDefaultContent' of undefined
Could someone guide me in the right direction?
Thanks in advance.