Restore buttons to review tables

- Switch from dataTable (returns a jquery object) to
  DataTable (returns a DataTables API object)
- Update versions of libraries

Doesn't quite work, needs the full version of jquery rather than the
slim version.
This commit is contained in:
James Polley 2018-08-01 02:50:12 +00:00 committed by James Polley
parent 494d9a6db0
commit 5d029c2c06

View file

@ -61,7 +61,7 @@
<script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.18/b-1.5.2/b-colvis-1.5.2/b-html5-1.5.2/b-print-1.5.2/cr-1.5.0/fc-3.2.5/fh-3.1.4/kt-2.4.0/r-2.2.2/rg-1.0.3/rr-1.2.4/datatables.min.js"></script> <script type="text/javascript" src="//cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.18/b-1.5.2/b-colvis-1.5.2/b-html5-1.5.2/b-print-1.5.2/cr-1.5.0/fc-3.2.5/fh-3.1.4/kt-2.4.0/r-2.2.2/rg-1.0.3/rr-1.2.4/datatables.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$("table.table-reviews").dataTable({ var reviewtable = $("table.table-reviews").DataTable({
"stateSave": true, "stateSave": true,
"lengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]], "lengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]],
"pageLength": 100, "pageLength": 100,
@ -80,6 +80,6 @@
text: 'Vote details', text: 'Vote details',
columns: '.votes' columns: '.votes'
}]}]}); }]}]});
table.buttons().container().appendTo( $('.col-sm-6:eq(0)', table.table().container() ) ); reviewtable.buttons().container().prependTo( $(reviewtable.table().container() ));
</script> </script>
{% endblock %} {% endblock %}