Problem extending print button
Problem extending print button

Hi,
I'm trying to extend the print button.
I've already implemeted to print only the selected row but I would also like to add an alert message containing some data of the selected row.
I've tried to do it but when I run the code it doesn't work.
This is what I've wrote:
$(document).ready(function () {
var table = $('#prescriptionsTable').DataTable({
dom: 'Bfrtip',
buttons: ['pdf',{
extend: 'print',
text: 'Print selected',
action: function(e, dt, button, config) {
var data = table.rows( { selected: true } ).data();
alert("Patient: " + data[0] + "\nDoctor: " + data[1]);
$.fn.dataTable.ext.buttons.print.action(e, dt, button, config);
}
}
],
select: true
});
What is wrong with the actions I've inserted?
Thanks in advance!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
What specifically does it do or don't do?
Do you get errors in the browser's console.
Please create a simple test case replicating the issue to help debug the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
My bad, there was just a missing comma after the } of action.
Thnaks for your reply, it helped me indentify the problem.