From HaFrWiki
Jump to: navigation, search

Datatables are a free library for adding interactive searchable sortable and editable Data inside tables to your website [1]
My earlier websites used Bootgrid (Rafael Staib: but since this framework was not that stable during a period I decided to move on to Datatables.


The Datatables website has many examples and tutorials.
This website is in no way intended to teach Datatables, but gives some tips and hints.



  • Javascript is enabled
  • Cookies are used
  • AJAX is used and basic AJAX understanding is avaialable.
  • jQuery is used
  • PHP (or other server side language)
  • Function $(document).ready exists


At the end of the $(document).ready use the scripts:

   function() {
      'use strict';
      var met  = ".ready";

      setTimeout( "tsDatatables(), 2000);
      setTimeout( "tsEvents()"   , 2500);
); // .ready

Responsive Mode

The implemented Responsive mode does a good job and is also good manageable.
But sometimes you want to change the way things are going.
First of all when do you want to go in responsive mode.
This snippet shows an example for enabling responsive only for screens smaller than 1080px in width

var dtList = $('#listDT).DataTable( {
   responsive  : window.innerWidth < 1080 ? true : false,

See also




  1., Datatables home page.