Category Archives: datatable

Show custom error messages from server side

The key is to add a listener to “xhr.dt” event before initialize datatable plugin.

Server side:

 

Reference:

  1. https://datatables.net/reference/event/xhr

Custom http error response in JSON

Server side (PHP):

Client (with datatable):

Result in Chrome dev tool:

Datatable Server Side Processing (Laravel)

Javascript:

Config:

 

Controller:

Model:

 

Localization of datatable

Localization file:

Sample code:

Display priority:

  1. Localization file
  2. paginate option
  3. aria

Reference:

Datatable Server Side Processing

Javascript:

Server:

 

Select All Checkboxes

Reference:

Full Control Ajax in datatable

 

Usage of jQuery Datatable

Hide ID column but still able to get item ID:

Use CSS instead of “columnDefs”:

Reference:

  1. http://stackoverflow.com/questions/14372655/jquery-datatables-hide-column-without-removing-it-from-dom

CSS:

 

 

Localized txt file content:

Reference: