Footer totals not being exported to XLS
Footer totals not being exported to XLS
myqalan
Posts: 13Questions: 0Answers: 0
Allan,
I've got the Table Tools plugin working, but I noticed that when the data is saved to an XLS file the column totals are not being sent with the rest of the data. Is there any way to force the export functionality to include these? The totals come from the fnFooterCallback function which does the calculations.
I've got the Table Tools plugin working, but I noticed that when the data is saved to an XLS file the column totals are not being sent with the rest of the data. Is there any way to force the export functionality to include these? The totals come from the fnFooterCallback function which does the calculations.
This discussion has been closed.
Replies
TableTools does not include the table footer in the example information. If you want to add it in you will need to modify fnGetDataTablesData in TableTools.js a little bit. I've added it to my to do list for the next release of TableTools as an optional feature.
Regards,
Allan
I apologize, but I have been trying to get this to work for almost 8 hours. I have tried everything I can think of (its probably really simple) to get this to work. I have been trying to modify the fnGetDataTablesData function, but am at a loss. Is there any more of a pointer that you can give me.
I'm not asking for you to write the code, but I honestly can't figure out how to force it to see the footer. Everything I have tried ends up with a blank file being saved (I guess that means I broke the function without breaking the JS).
Thanks,
Mike
I think this is one of the rare occasions where I will "just write the code" :-). Will save you a lot of time, and didn't take me long:
[code]
/* Add the footer */
for ( i=0, iLen=_DTSettings.aoColumns.length ; i/g, "" );
sData += fnBoundData( sLoopData, sBoundary, regex ) + sSeperator;
}
}
sData = sData.slice( 0, sSeperator.length*-1 );
[/code]
That chuck will read the information from the table footer (live from the DOM, so your information in the footer put there by the callback will be correct), and add it to the output. It needs to go at the end of fnGetDataTablesData(), just before the return and "_sLastData = sData;" lines. If you have any problems, let me know.
Regards,
Allan
[code]
/* No pointers here - this is a string copy :-) */
_sLastData = sData;
return sData;
[/code]
It disabled my copy to clipboard and when opening the xls file it was empty.
Ive added the code, but still ive the same issue...is there a solution...
I ve been facing the same problem...It would be very greatful if u juz hlp us in this issue...I need to xport the PDf along wth the footr calculatd by fnFooterCallback function...Thnax in advance
I think users can get the footer information printed if they use in place . It will not make any difference to the table UI and all the data will be exported to excel file.
thanks,
V
Thanks for your suggestion..Even changing tfoot to thead i cant export the footer totals to any of the file format (.pdf,.xls,.csv)..
Thanks.
Thanx Vacciph.But changing to had no effect on it...Its not exporting the values calculated by the function footercallback...Pls help me with this...
reg
sathi
Below is my code ...
$(document).ready( function () {
$('table#tfilter').dataTable( {
"iDisplayLength": 5000,
"sDom": 'T&f&F',
//*for calculating footer totals*//
"fnFooterCallback": function (nRow, aasData, iStart, iEnd, aiDisplay ) {
$($(nRow).children()).remove();
if(iEnd > 0) { // if search result is empty do nothing
for(var i=0;i
Also, please do not swear in this forum and show a little courtesy. If you have suggestions for how TableTools can be improved they are very welcome. Equally, TableTools is open source and you are feel to modify it to suit your needs.
Thank you,
Allan
if ( _oSettings.bIncHiddenColumns === true || _DTSettings.aoColumns[i].bVisible )
be changed to:
if ( _oSettings.mColumns === 'visible' || _DTSettings.aoColumns[i].bVisible )