How to sum columns in DataTables 1.10.11
How to sum columns in DataTables 1.10.11
I want to total columns and add to the tfoot. I have achieved this by adding the DataTables_sum plugin.
The problem is that a number of the columns are rendered as hyperlinks, so the sum returns NaN.
I initially got around this problem, but directly writing the totals to the datatable by:
$('div.dataTables_scrollFootInner table tfoot tr td:eq(1)','#tblDebtors_wrapper').html(value);
However, when I then use the print option to print the table, I don't get the total row in the print.
I guess my questions is:
1. Can the sum (or other function) total even on a rendered colum?
2. If not, can the print be made to create these totals?
Many thanks.
Answers
Sounds like you need to "derender it". Perhaps get the original data value, or strip the HTML. Without a link to the page (per the forum rules), it is impossible to say exactly what the best approach is.
Allan