datatable buttons code example
Example 1: datatable
<link href="//cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css">
<script src="//cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
<table id="Table_ID">
<thead>
<tr>
<th>Table_Head_1</th>
<th>Table_Head_2</th>
<th>Table_Head_3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Table_Data_1</td>
<td>Table_Data_2</td>
<td>Table_Data_3</td>
</tr>
</tbody>
</table>
<script>
$(document).ready( function () {
$('#Table_ID').DataTable();
} );
</script>
Example 2: datatable buttons
dom: 'Blfrtip',
buttons: [
{
extend: 'excelHtml5',
footer: true,
},
{
extend: 'csvHtml5',
footer: true,
},
{
extend: 'pdfHtml5',
footer: true,
},
],
lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
Example 3: data table buttons
Javascript12345678var table = $('#example').DataTable( { buttons: [ 'copy', 'excel', 'pdf' ]} ); table.buttons().container() .appendTo( $('.col-sm-6:eq(0)', table.table().container() ) );