Loop of footer callback
Loop of footer callback
cha59
Posts: 87Questions: 23Answers: 0
Does anyone have an idea of how to loop the footer callback. I'm about to have 40 columns, so it would be nice to loop through this code instead of making code for each column. Example for columns 8 to 10
// Total over this page
pageTotal = api
.column( 8, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
// Update footer
$( api.column( 8 ).footer() ).html(
pageTotal
);
// Total over this page
pageTotal = api
.column( 9, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
// Update footer
$( api.column( 9 ).footer() ).html(
pageTotal
);
// Total over this page
pageTotal = api
.column( 10, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
// Update footer
$( api.column( 10 ).footer() ).html(
pageTotal
);
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You can use a simple for loop. Maybe something like this:
Didn't try it but it seems like it would work
Kevin
Thanks a lot Kevin, it works!
Claus