Make datatable work for each table on the page, not just the first

This commit is contained in:
James Polley 2017-10-05 00:55:30 +11:00
parent 8f28a444a2
commit 8aa1148f7a

View file

@ -49,12 +49,12 @@
<script src="{{ STATIC_URL }}datatables/js/dataTables.bootstrap.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js"></script>
<script type="text/javascript">
$(function() {
$("table.table-reportdata").dataTable({
$("table.table-reportdata").each(function () {
$(this).dataTable({
"sDom": "<'row'<'col-md-3'l><'col-md-3'T><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>",
"sPaginationType": "bootstrap",
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"bStateSave": true,
"aLengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]],
"oTableTools": {
"aButtons": [
"copy",