ArchDevOps
ArchDevOps

Reputation: 99

JS: datatables printing and exporting excel

hello there guys I have a question this might be newbie question

I have a datatable in my website now I want to print or export it in excel file the problem I am getting is that the tag <tfoot></tfoot> was not included in printing and in export

this are my code:

JS:

<script type="text/javascript" class="init">
$(document).ready(function() {
  $('#example').DataTable( {
    dom: 'Bfrtip',
    buttons: [
      {
        extend: 'print',
        customize: function ( win ) {
          $(win.document.body)
            .css( 'font-size', '10pt' )
            .prepend(
              '<img src="http://datatables.net/media/images/logo-fade.png" style="position:absolute; top:0; left:0;" />'
            );

          $(win.document.body).find( 'table' )
            .addClass( 'compact' )
            .css( 'font-size', 'inherit' );
        }
      }
    ]
  } );
} );

</script>

Upvotes: 0

Views: 72

Answers (1)

lzagkaretos
lzagkaretos

Reputation: 2910

You can add footer: true option.

// ...
extend: 'print',
footer: true,
// ...

For more information, take a look here.

Upvotes: 1

Related Questions