I am trying to print current filter from jQuery DataTable to a PDF.
I am searching for a solution but usually results are for TableTools but it's retired, so I am using Buttons.
With TableTools, I tried to apply this code:
$('#example').dataTable( {
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
{
"sExtends": "copy",
"sButtonText": "Copy to clipboard",
"oSelectorOpts": {
page: 'current'
}
}
]
}
} );
From here https://datatables.net/extensions/tabletools/button_options#oSelectorOpts
And this is my code:
$(document).ready(function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
{
extend: 'pdfHtml5',
download: 'open'
}
]
} );
} );
Already tried to change many times, still prints all the rows. What am i doing wrong?
You need to do something like this:
`