datatables v1.10.20 testing
Combined js/css from datatables cdn
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/cupertino/jquery-ui.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/v/ju/jq-3.6.0/jszip-2.5.0/dt-1.11.5/af-2.3.7/b-2.2.2/b-colvis-2.2.2/b-html5-2.2.2/b-print-2.2.2/cr-1.5.5/fc-4.0.2/fh-3.2.2/kt-2.6.4/r-2.2.9/rg-1.1.4/rr-1.2.8/sc-2.0.5/sp-2.0.0/sl-1.3.4/datatables.min.css">
<script src="https://cdn.datatables.net/v/ju/jq-3.6.0/jszip-2.5.0/dt-1.11.5/af-2.3.7/b-2.2.2/b-colvis-2.2.2/b-html5-2.2.2/b-print-2.2.2/cr-1.5.5/fc-4.0.2/fh-3.2.2/kt-2.6.4/r-2.2.9/rg-1.1.4/rr-1.2.8/sc-2.0.5/sp-2.0.0/sl-1.3.4/datatables.min.js"></script>
<h3>Datatables 1.11.5</h3>
<table width="100%" class="display dataTable" id="example" style="width: 100%;" cellspacing="0">
<thead>
<tr role="row">
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot style="display:none;">
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Airi Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>2008/11/28</td>
<td>$162,700</td>
</tr>
<tr>
<td>Angelica Ramos</td>
<td>Chief Executive Officer (CEO)</td>
<td>London</td>
<td>47</td>
<td>2009/10/09</td>
<td>$1,200,000</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
...
CSS
td { white-space: nowrap; }
th { white-space: nowrap; }
JavaScript
$.extend(true, $.fn.dataTable.defaults, {
dom: 'Bfrtip',
"scrollY": "35vh",
"scrollCollapse": true,
"paging": true,
buttons: [{
text: 'High priority',
action: function() {
console.log('High');
},
split: [{
text: 'Medium priority',
action: function() {
console.log('Med');
}
},
{
text: 'Low priority',
action: function() {
console.log('Low');
}
}
],
},
]
});
var table = $("#example").DataTable();
(function() {
var url = 'https://debug.datatables.net/bookmarklet/DT_Debug.js';
if (typeof DT_Debug != 'undefined') {
if (DT_Debug.instance !== null) {
DT_Debug.close();
} else {
new DT_Debug();
}
} else {
var n = document.createElement('script');
n.setAttribute('language', 'JavaScript');
n.setAttribute('src', url + '?rand=' + new Date().getTime());
document.body.appendChild(n);
}
})();