How I can use columnDefs and buttons for print?
How I can use columnDefs and buttons for print?
saleemms
Posts: 5Questions: 3Answers: 0
Hi All,
I want to remove sorting from all columns in the table and want to add a print button on top.
But when I am using below code the print
button is missing:
$('#printData').DataTable({
dom: 'Bfrtip',
"paging": false,
"iDisplayLength": -1,
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>'
}],
columnDefs: [{
"visible": true,
"searchable": true
}],
});
Please let us know I can use both?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Looks like your code should work. Do you have all the correct Buttons JS and CSS files? You can get them using the Download Builder.
Not sure what your goal with columnDefs is but you haven't defined the target columns with
columnDefs.targets
so it probably isn't doing anything for you.If you continue to have problems please post a link to your page or a test case replicating the issue so we can help.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin