"buttons": ["copy", { extend: "csv", text: "CSV", action: function(e, dt, button, config) { pageTitle.innerHTML = "PURCHASE REGISTER REPORT"; $.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, button, config); } }, { extend: "excel", text: "Excel", action: function(e, dt, button, config) { // Your custom onClick function here pageTitle.innerHTML = "PURCHASE REGISTER REPORT"; console.log("Excel button clicked!"); $.fn.dataTable.ext.buttons.excelHtml5.action.call(this, e, dt, button, config); } }, { extend: "pdf", text: "PDF", action: function(e, dt, button, config) { pageTitle.innerHTML = "PURCHASE REGISTER REPORT"; console.log("PDF button clicked!"); $.fn.dataTable.ext.buttons.pdfHtml5.action.call(this, e, dt, button, config); } }, { extend: "print", text: "Print", action: function(e, dt, button, config) { pageTitle.innerHTML = "PURCHASE REGISTER REPORT"; console.log("Print button clicked!"); $.fn.dataTable.ext.buttons.print.action.call(this, e, dt, button, config); } }, "colvis" ]