JavaScript
var rid="3";
var yr="2024";
var mtg=0;
var mg=0;
var bsum=0;
var tableTN = $('#TdataTable').DataTable( {
columnDefs: [{
"className": "dt-center",
"targets": "_all"
}],
"ordering": false,
"stateSave": true,
"serverSide": false,
"fixedHeader": true,
"paging": true,
"pageLength": 100,
"lengthMenu": [[10, 25, 50,100, -1], [10, 25, 50,100, "All"]],
"ajax": {
'type': 'POST',
'url':baseURL +'targetList',
'data': {
id: rid,
year: yr
},
"dataSrc": function(json) {
mtg=Math.round(json.target/12);
mg=mtg;
$('#exe').text(json.exe);
console.log(json.exe);
$('#yr').text(json.yr);
return json.data;
},
},
'columns': [
{ data: 'Clientname' },
{ data: 'JAN' },
{ data: 'FEB' },
{ data: 'MAR' },
{ data: 'APR' },
{ data: 'MAY' },
{ data: 'JUN' },
{ data: 'JUL' },
{ data: 'AUG' },
{ data: 'SEP' },
{ data: 'OCT' },
{ data: 'NOV' },
{ data: 'DEC' },
{ data: 'Total' }
],
"footerCallback": function(row, data, start, end, display) {
var api = this.api();
var secondaryFooterValues = [];
var thirdFooterValues = [];
secondaryFooterValues.push("Target");
thirdFooterValues.push("Achieved");
var sum=0;
api.columns('.sum', {
page: 'current'
}).every(function() {
sum = this
.data()
.reduce(function(a, b) {
var x = parseFloat(a) || 0;
var y = parseFloat(b) || 0;
return x + y;
}, 0);
$(this.footer()).html(sum);
bsum=mg-sum;
secondaryFooterValues.push(mg);
thirdFooterValues.push(Math.round(sum/mg*100)+"%");
mg=mtg+bsum;
});
secondaryFooterValues[13]=mtg*12;
thirdFooterValues[13]=Math.round((sum/(mtg*12))*100)+"%";
var secondaryFooter = $(api.table().footer()).find('.secondary-footer');
if (secondaryFooter.length === 0) {
secondaryFooter = $('').appendTo(api.table().footer());
}
secondaryFooter.empty(); // Clear existing content
secondaryFooterValues.forEach(function(value) {
$('').html(value).appendTo(secondaryFooter);
});
var thirdFooter = $(api.table().footer()).find('.third-footer');
if (thirdFooter.length === 0) {
thirdFooter = $('').appendTo(api.table().footer());
}
thirdFooter.empty(); // Clear existing content
thirdFooterValues.forEach(function(value) {
$('').html(value).appendTo(thirdFooter);
});
},"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
$('td', nRow).eq(0).css('color', 'blue');
},
//dom: 'rtl',
dom: 'Brtip',
"buttons": [
{
extend: 'excelHtml5',
exportOptions: {
rows: function(idx, data, node) {
return true; // Export all rows
},
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
footer: true
}
},
{
extend: 'pdfHtml5',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
footer: true
}
}
],
} );when i export data to excel sheet footers content did not available in the table.how do i get? Please assist me..
Thanks

Amit MohantyRank #112 · 20K reputationPosted Apr 12, 2024, 1:36 AM EDT
Could you please specify the problem you're facing with the footer? This will help us to understand what you're trying to achieve and how we can assist you better.
Ajithkumar T19 reputationPosted Apr 12, 2024, 9:11 AM EDT
I export a excel file using above code,in that file i got only headers and table data there is no footer values,secondaryFooter and thirdFooter values.
poppy mizzi17 reputationPosted Apr 11, 2024, 11:23 PM EDT
I would suggest engaging in scribble io if you have a penchant for both drawing and general knowledge. A participant is chosen to represent a subject in each round, with the remaining participants being instructed to deduce that individual's identity.