Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82266

Footer Content calculated in fnFooterCallback not exported

$
0
0
I have a DataTable, with TableTools, where I am generating column totals in the footer using the fnFooterCallback function. While the footer content display as expected in the HTML version of the DataTables, the export to PDF (or CSV) does not include the footer data as generated in the callback.

DataTables debug bookmarklet: atamaz
DataTables 1.9.4
TableTools 2.1.4

A very basic example, with the minimal amount of code to reproduce the issue: Demonstration: http://dev-3.staging.wedu.com/ttools_test.php

my initialization and fnFooterCallback:
$(document).ready( function () {
    $('#example').dataTable( {
        "sDom": 'T<"clear">lfrtip',
        "fnFooterCallback": function( nFoot, aData, iStart, iEnd, aiDisplay ) 
        {
            $(nFoot).append('<td>Grand Totals:</td>');

            var tot = 0;
            for (var i=0; i<aData.length; i++)
            {
                tot += aData[i][1]*1;
            }
           $(nFoot).append('<td>' + tot + '</td>' );
        },
        "oTableTools": {
             "sSwfPath": "TableTools-2.1.4/media/swf/copy_csv_xls_pdf.swf"
        }
    } );
} );

my html
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
	<thead>
		<tr>
			<th>String</th>
			<th>Int</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
		</tr>
	</tfoot>
	<tbody>
		<tr>
			<td>One</td>
			<td>1</td>
		</tr>
		<tr>
			<td>Two</td>
			<td>2</td>
		</tr>

	</tbody>
</table>



Viewing all articles
Browse latest Browse all 82266

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>