Excel button is not showing up in Chrome
Excel button is not showing up in Chrome
Hi guys, I tried DataTables in my application and want export to excel button. Below is my code.
var datatableInstance = $("#tableId").DataTable({
data : data,
columns : [
{ 'data':'CUSTOMER_ID' },
{ 'data':'REGION' },
{ 'data':'BANK_EMAIL' },
{ 'data': null }
],
"bDestroy": true,
"bSort": false,
"columnDefs": [ {
"targets": -1,
"data": null,
"defaultContent": "<button type='button' id='use-address' class='open-AddBookDialog btn btn-default' data-toggle='modal' data-target='#myModal' style='width:200px;'>UPDATE</button>",
"width": '20%',
"searchable":false
} ],
dom : 'Bfrtip',
buttons:[ 'excel' ]
});
});
I am able to get this button on chrome version 63.0.3239.84, but not able to get it in version 65.0+
Styling URLs:-
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.1/css/buttons.dataTables.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/responsive/2.2.1/css/responsive.bootstrap.min.css"/>
jQuery URLs:-
Help me on this. There is some version compatibility for sure but not able to find out the correct plugin for the chrome version 65.0+
Answers
Adding to the above post
jQuery URLs :-
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.flash.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/responsive/2.2.1/js/dataTables.responsive.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/responsive/2.2.1/js/responsive.bootstrap.min.js"></script>
I had this same problem, and it was resolved by adding to the header:
Note that it did not work when I had that loaded on the bottom of the page.
Yes, you need JSZip for the
excelHtml5
button type to work.The download builder can help make sure you have any dependencies.
Allan