Uncaught Cannot extend unknown button type: print
Uncaught Cannot extend unknown button type: print
antonioribeiro
Posts: 2Questions: 1Answers: 0
All my buttons are working fine except for print. I'm using html5 buttons for PDF and Excel, but when I try to extend print or even using it without extending it gives me this error.
This is what I'm loading
loadScript("smartadmin/1.8.5/js/plugin/datatables/jquery.dataTables.min.js", function(){
loadScript("smartadmin/1.8.5/js/plugin/datatables/dataTables.colVis.min.js", function(){
loadScript("smartadmin/1.8.5/js/plugin/datatables/dataTables.bootstrap.min.js", function(){
loadScript("smartadmin/1.8.5/js/plugin/datatable-responsive/datatables.responsive.min.js", function(){
loadScript("//cdn.datatables.net/buttons/1.2.2/js/dataTables.buttons.min.js", function(){
loadScript("//cdn.datatables.net/buttons/1.2.2/js/buttons.html5.min.js", function(){
loadScript("//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js", function(){
loadScript("//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js", function(){
loadScript("//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js", function(){
loadScript("//cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.13/clipboard.min.js", function(){
new Clipboard('#copy-to-clipboard-btn');
loadScript("assets/plugins/datatables/fnSetFilteringDelay.js", pagefunction)
});
});
});
});
});
});
});
});
});
});
This is how I'm creating my buttons:
function datatablesButtons(filename, message) {
var name = "System";
return [
"copyHtml5",
{
text: "Excel",
extend: "excelHtml5",
title: filename,
},
{
text: "PDF",
extend: "pdfHtml5",
filename: filename,
title: name,
message: message,
pageSize: "letter",
},
{
text: "Print",
extend: "print",
message: '<span class="pull-left">'+name+'</span><span class="pull-right">'+message+'</span>',
}
];
}
And this is how buttons are created on table:
"sDom": "<'dt-toolbar'<'col-xs-12 col-sm-6'f><'col-sm-6 col-xs-6 hidden-xs'TB>r>"+
"t"+
"<'dt-toolbar-footer'<'col-sm-6 col-xs-12 hidden-xs'i><'col-sm-6 col-xs-12'p>>",
"autoWidth" : true,
buttons: datatablesButtons(
'{{ $filenameTimestamp }}',
'{{ config("app.study.name")." Study (".config("app.study.id").")" }}'
),
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You need to include the buttons.print.min.js file as well if you want the print button.
Allan
I was that, thank you!