Not able to see the csv and excel buttons using the html5 button
Not able to see the csv and excel buttons using the html5 button
Hi,
Am using the html5 button feature for the export functionality but am not able to see the csv and the excel buttons. All I am able to generate is the copy and the print button. Below's the code snippet:
$(document).ready(function () {
$('#Promo_Example').dataTable({
"dom": 'Bfrtip',
buttons: ['copyHtml5', 'csvHtml5', 'excelHtml5', 'print'],
"ajax": {
"url": "sample.json.txt",
"dataSrc": "Sample"
},
"columns": [
{
"data": null,
"render": function ( data, type, full, meta ) {
return '<a href="{0}" target="_blank">{1}</a>'.format(data.test, data.Name);
}
},
{ "defaultContent": '', "data": "test" },
{ "defaultContent": '', "data": "test1" },
{ "defaultContent": '', "data": "test2" },
{ "defaultContent": '', "data": "test3" },
{ "defaultContent": '', "data": "test4" },
{ "defaultContent": '', "data": "test5" }
],
});
});
Am using the following references:
https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js
https://nightly.datatables.net/buttons/js/dataTables.buttons.min.js
https://nightly.datatables.net/buttons/js/buttons.print.min.js?1
https://nightly.datatables.net/buttons/js/buttons.html5.js?2
https://cdn.datatables.net/buttons/1.0.3/css/buttons.dataTables.min.css
https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css
Any help a.s.a.p would be greatly appreciated. Also I cannot share a link for debugging since it's on an internal server. Also I see no error in the console.
Answers
Move it to live.datatables.net so we can replicate it, because this looks like it should be fine, but apparently you've got something wrong, just cant see it like that.
Hi There,
Thanks a lot for inspecting the issue. As requested please find the replicated link below:
http://live.datatables.net/zonoluzo/1/
Appreciate your help with this.
The dependencies haven't been loaded for the Excel button. Specifically the JSZip library is required if you want the Excel button - see
excelHtml5
.For the CSV button, that appears to show up just fine for me in your example. What browser and OS are you using?
Allan
Thanks a lot Allan.. Works now :). An off the track question, is there any way that we can force the IE browser mode from default 8 to EDGE using JavaScript/ jQuery. Thanks again!
IE will default to the newest mode available to it unless instructed otherwise. If it is dropping back to IE8 for you then perhaps the doctype is transitional or there is some invalid markup. That would be one for an IE specific forum (MSDN perhaps).
Allan
Thanks a ton..