Reputation: 441
I use DataTable print button to print files. I'd like to add another div
to be printed above or under the table.
I use this script in datatable to add some header
title : "This should be another element printed above the DataTable<br /><span id='txt-small' style='font-size:'12px !important;'>Dates : </span>",
But, it's probably not the right method because I may add a complex header above the DataTable.
I also use footer : true,
to add something to print in <tfoot>
but then again I may add a complex footer under the DataTable.
So, how do I add another element div
or table
to be printed above or under the DataTable when I print the table?
Upvotes: 3
Views: 4085
Reputation: 1810
You can use the customize
method:
{
extend: 'print',
title: ' ',
message: ' ',
customize: function(win) {
$(win.document.body).append('<html elements here>'); //after the table
$(win.document.body).prepend('<html elements here>'); //before the table
}
},
Reference here : Customisation of the print view window
Upvotes: 4