Exporting data from a table can often be a key part of a complex application. The Buttons extension for DataTables provides three plug-ins that provide overlapping functionality for data export:
HTML5 export buttons - makes use of HTML5 APIs to create files client-sideFlash export buttons - uses Adobe Flash for legacy browsers
Print button
Both sets of buttons provide:
The Javascript shown below is used to initialise the table shown in this example:
$(document).ready(function() { $('#example').DataTable( { dom: 'Bfrtip', buttons: [ 'copy', 'csv', 'excel', 'pdf', 'print' ] } );} );
In addition to the above code, the following Javascript library files are loaded for use in this example:
- https://code.jquery.com/jquery-3.3.1.js
- https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js
- https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js
- https://cdn.datatables.net/buttons/1.5.6/js/buttons.flash.min.js
- https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js
- https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js
- https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js
- https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js
- https://cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js
The following CSS library files are loaded for use in this example to provide the styling of the table:
- https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css
- https://cdn.datatables.net/buttons/1.5.6/css/buttons.dataTables.min.css







0 Comments:
Post a Comment