[Fixed]-Csv button won't appear in datatables

1👍

You’re simply missing some script files (specifically the buttons extension file and the JSZip file (which is required for the csv/excel buttons specifically). I’d recommend going to the DataTables download builder, which will allow you to pick the extensions you want and will then give you a nice download package to include the script files you need.

I quickly generated this list below which contains just those script files required for DataTables and the csv button:

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.2.2/css/buttons.dataTables.min.css"/>

<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.2.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.2.2/js/buttons.html5.min.js"></script>

I wouldn’t recommend just copy/pasting this script (instead use it as an example) but instead go to the DataTables download builder and ensure you have the required scripts (remember you MUST have JSzip for HTML5 export to csv.

Leave a comment