Skip to content

Latest commit

 

History

History
35 lines (28 loc) · 900 Bytes

DataTables.md

File metadata and controls

35 lines (28 loc) · 900 Bytes

DataTables JS Library

Documentation here

Requirements:

  • JQuery

Usage:

Include the CSS and JS code for DataTables to the head and bottom of the body of your website, respectively. CSS is not required.

<link rel="stylesheet" type="text/css" href= "{{ url_for('static',filename='style.css') }}"> 

<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>

Use the single function bellow to call to initialise the tabl. Do not forget to add an id tag to the table.

$(document).ready(function(){
    $('#myTable').DataTable();
});

Add options like so:

$(document).ready(function() {
  $('#myTable').DataTable( {
    "columnDefs": [
      { "orderable": false, "targets": [2,3,4] }
    ],
    "paging": false,
    "order": [[ 0, "asc" ]]
  } );
} );