fnProcessingIndicator

Show and hide the DataTables processing element through the API.

  • Author: Allan Chappell

When doing some heavy processing of your own (for example using fnOpen with data loading from the server) it can be useful to make use of the 'processing' indicator built-into DataTables. This plug-in function exposes the internal DataTables function so it can be used for exactly this.

Plug-in code

jQuery.fn.dataTableExt.oApi.fnProcessingIndicator = function ( oSettings, onoff )
{
    if ( onoff === undefined ) {
        onoff = true;
    }
    this.oApi._fnProcessingDisplay( oSettings, onoff );
};

CDN

This plug-in is available on the DataTables CDN:

JS

Note that if you are using multiple plug-ins, it is beneficial in terms of performance to combine the plug-ins into a single file and host it on your own server, rather than making multiple requests to the DataTables CDN.

Version control

If you have any ideas for how this plug-in can be improved, or spot anything that is in error, it is available on GitHub and pull requests are very welcome!

Example

var table = $('#example').dataTable();
  table.fnProcessingIndicator();      // On
  table.fnProcessingIndicator(false); // Off