TestDatatableSNS
by ioclaudio
HTML
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.10.24/b-1.7.0/b-html5-1.7.0/b-print-1.7.0/date-1.0.3/r-2.2.7/sb-1.0.1/datatables.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.10.24/b-1.7.0/b-html5-1.7.0/b-print-1.7.0/date-1.0.3/r-2.2.7/sb-1.0.1/datatables.min.js"></script>
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th>Nome</th>
<th>Ruolo</th>
<th>Office</th>
<th>EtĂ </th>
<th>Data inizio</th>
<th>Salario</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012/03/29</td>
<td>$433,060</td>
</tr>
<tr>
<td>Airi Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
...
JavaScript
$(document).ready(function() {
var table = $('#example').DataTable({
responsive: true,
autoFill: true,
dom: 'QBlfrtip',
buttons: [
'csvHtml5', 'excelHtml5', 'pdfHtml5', 'print'
],
"scrollX": true,
"order": [[ 1, "asc" ]],
language: {
url: 'https://cdn.datatables.net/plug-ins/1.10.24/i18n/Italian.json',
},
orderCellsTop: true,
initComplete: function () {
console.log('@@@ init complete @@@');
// $("body").removeClass("loading");
table.columns.adjust();
}
});
});