EDDY
EDDY

Reputation: 103

DataTable print function - How to hide or remove the title and set the filename?

How do I hide or remove the title from the page I print and set the filename when I save the file into PDF or xps?

$('#report').dataTable( {
  dom: 'Bfrtip',
  buttons: [{
    extend: 'print',
    title: 'I want to hide this but use it as my filename when I save it.'
  }]
});

Upvotes: 1

Views: 3459

Answers (3)

Navneet Kaushik
Navneet Kaushik

Reputation: 35

Leave 'title' as empty...

$('#datatable').DataTable( {
   buttons: [
               { 
                  extend: 'excel',
                  text: 'Download Excel',
                  title: ''
                }
            ]
});

Upvotes: 0

s.jone
s.jone

Reputation: 21

you can use the bellow sample code

$('#report').dataTable( {
  dom: 'Bfrtip',
  buttons: [{
    extend: 'print',
    title: ''
  },
{
    extend: 'pdf',
    title: 'your file name'
  },
  ]
});

Upvotes: 1

soreal
soreal

Reputation: 264

('#report').dataTable( { dom: 'Bfrtip', buttons: [{ extend: 'print', title: 'Filename here.', customize: function ( win ) { $(win.document.body).children("h1:first").remove(); } }] });

Upvotes: 4

Related Questions