Export multiple footer rows with - dom: 'Bfrtip',
Export multiple footer rows with - dom: 'Bfrtip',
how we can export multiple tfoot row in below code i am getting only one footer row and what we can use for 'print' because 'printHtml5' not working
var table = $('.assesment-list').DataTable({
dom: 'Bfrtip',
"pageLength": -1,
"lengthMenu": [[100, 200, 300, 500, -1], [100,200, 300,500, "All"]],
"fixedHeader": {
"header": true,
"footer": false
},
"columnDefs": [
{ "width": "10px", "targets": 0 },
{ "width": "40px", "targets": 1 },
{ "width": "100px", "targets": 2 },
{ "width": "70px", "targets": 3 },
{ "width": "70px", "targets": 4 },
{ "width": "70px", "targets": 5 },
{ "width": "70px", "targets": 6 },
{ "width": "70px", "targets": 7 },
{ "width": "70px", "targets": 8 }
],
"iDisplayLength": 100,
buttons: [
{
extend: 'print',
exportOptions: {
columns: [0,1, 2, 3, 4, 5, 6,7,8]
}
},
{
extend: 'pdfHtml5', footer: true,
exportOptions: {
columns: ["0,1, 2, 3, 4, 5, 6,7,8"]
},
},
{
extend: 'csv',
exportOptions: {
columns: [0,1, 2, 3, 4, 5, 6,7,8]
}
},
{
extend: 'copy',
exportOptions: {
columns: [0,1, 2, 3, 4, 5, 6,7,8]
}
}
],
footerCallback: function (row, data, start, end, display) {
var api = this.api(),
data;
set_footer_total(api,5);
set_footer_total(api,6);
}
});
<tfoot>
<tr>
<td colspan="5"><strong>{{ __('Income Amount') }}</strong></td>
<td class="amount">{{ __(format_dollar($income_total, 2, '.', '')) }}</td>
<td class="amount">{{ format_dollar($monthincome_total, 2, '.', '')}}</td>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="5"><strong>{{ __('Savings Amount')}}</strong></td>
<td class="amount">{{ __(format_dollar($savings_total, 2, '.', '')) }}</td>
<td class="amount">{{ format_dollar($monthsavings_total, 2, '.', '')}}</td>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="5"><strong>{{ __('Expense Amount')}}</strong></td>
<td class="amount">{{ __(format_dollar($expense_total, 2, '.', '')) }}</td>
<td class="amount">{{ format_dollar($monthexpense_total, 2, '.', '')}}</td>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="5"><strong>{{ __('Total amount') }}</strong></td>
<?php
$total_amt = $income_total - ($savings_total+$expense_total);
?>
<td class="amount">{{ __(format_dollar($total_amt, 2, '.', '')) }}</td>
<?php
$monthtotal_amt = $monthincome_total - ($monthsavings_total+$monthexpense_total);
?>
<td class="amount">{{ format_dollar($monthtotal_amt, 2, '.', '')}}</td>
<td colspan="3"></td>
</tr>
</tfoot>
Answers
You can't - yet. It is coming though! DataTables 2 has much better support (through its API) for multi-row headers and footers, and Buttons 3 (which will be released alongside DataTables 2) will include full support for exporting multi-row headers and footers, and colspan / rowspan in the header / footer.
I have hopes of releasing DataTables 2 before the end of the year. The multi-row header / footer code has all been committed and tested, but I'm working my way through all of the extensions to bring everything up to date. Three to go.
Allan
thanks a lot for informing me,
will you please update me once datatable 2 code is released
Best place to find out at the moment will be the DataTables blog. Or check back at the end of the year.
Allan
Thankyou @allan