Footer Total repeating in pdf ?
Footer Total repeating in pdf ?
alka
Posts: 4Questions: 3Answers: 0
when I am printing the report, in pdf its footer is repeating. Please help
$(document).ready(function() { var hidden_startdate_avail = $(".hiddendate_avail1").val(); var hidden_enddate_avail = $(".hiddendate_avail2").val(); $('#table_id').DataTable({ paging: false, scrollY: 780, fixedHeader: { footer: true }, "order": [], "oLanguage": { "sEmptyTable": "No Data available for this selection" }, dom: 'Bfrtip', buttons: [{ extend: 'csvHtml5', text: '', titleAttr: 'Download CSV', extension: '.csv', filename: 'Time Tracking Report - with Session details', exportOptions: { modifier: { page: 'current' } } }, { extend: 'pdfHtml5', text: '', titleAttr: 'Download PDF', alignment: 'center', bProcessing: true, footer: true, title: 'Time Tracking Report - with Session details', orientation: 'landscape', pageSize: 'LEGAL', message: 'Start Date:: ' + hidden_startdate_avail + ' - End Date:: ' + hidden_enddate_avail, pageSize: 'A4', exportOptions: { modifier: { page: 'current' } } }], "footerCallback": function(row, data, start, end, display) { var api = this.api(), data; // Remove the formatting to get integer data for summation var intVal = function(i) { return typeof i === 'string' ? i.replace(/[\$,]/g, '') * 1 : typeof i === 'number' ? i : 0; }; // Total over all pages total = api .column(6) .data() .reduce(function(a, b) { var a = intVal(a) + intVal(b); var a = a.toFixed(2); return a; }, 0); // Update footer $(api.column(6).footer()).html(+total); } }); $('#table_id tbody') .on('mouseenter', 'td', function() { var colIdx = $(table.cell(this)).index().column; $(table.cells().nodes()).removeClass('highlight'); $(table.column(colIdx).nodes()).addClass('highlight'); }); $(".pdf_icon").click(function() { $(".loadingData").show(); setTimeout(function() { $(".loadingData").hide(); }, 500); }); $(".csv_icon").click(function() { $(".loadingData").show(); setTimeout(function() { $(".loadingData").hide(); }, 500); }); $('#table_id1').dataTable({ paging: false, scrollY: 780, "order": [], "oLanguage": { "sEmptyTable": " " } }); });
This discussion has been closed.