dataTable how I can hide the title and date when pring?

dataTable how I can hide the title and date when pring?

saleemmssaleemms Posts: 5Questions: 3Answers: 0
edited April 2019 in Free community support

Hi All,

I want to hide the website title tag and date when print.

Also, I want to add some text above the table. Like: 'Debtors Report'

How I can achieve this. Please help me!!!

I have tried below code for print the table:

$('#printData').DataTable({
  dom: 'Bfrtip',
  buttons: [
            {
                extend: 'print',
            }
    ]

});`

Thanks in advance!!!

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Hi @saleemms ,

    Here's the options for the print button,

    Cheers,

    Colin

  • saleemmssaleemms Posts: 5Questions: 3Answers: 0

    Hi @colin ,

    I have gone through this but I can't found to hide the website title and date.

    Thanks Saleem

  • colincolin Posts: 15,143Questions: 1Answers: 2,586
    Answer ✓

    Hi @saleemms ,

    I think you're referring to the area at the top which isn't part of the generated page as such - that's added by the browser. Either remove it like this, or do it in the code with something like this.

    Cheers,

    Colin

  • saleemmssaleemms Posts: 5Questions: 3Answers: 0

    @colin , Thanks for your answer.

    I have solved this issue at my end using below code:

    buttons: [{             
        extend: 'print', footer: true,
        title:'<div style="text-align:center;"><h1>Keer Industries</h2></div><div style="text-align:center;font-size:15px;"><br />Krisi Mandi ke piche<br /><br />Bilara<br /><br /></div>'
          }],
    
This discussion has been closed.