From 57a3d803217352be8521bd99eaa12b4c27dbc24f Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Thu, 17 Dec 2015 17:21:45 +0000 Subject: [PATCH] New - API: `processing()` method - Thread 31659 --- api/processing().js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 api/processing().js diff --git a/api/processing().js b/api/processing().js new file mode 100644 index 0000000..4006fc6 --- /dev/null +++ b/api/processing().js @@ -0,0 +1,30 @@ +/** + * Externally trigger the display of DataTables' "processing" indicator. + * + * @name processing() + * @summary Show / hide the processing indicator via the API + * @author [Allan Jardine](http://datatables.net) + * @requires DataTables 1.10+ + * @param {boolean} show `true` to show the processing indicator, `false` to + * hide it. + * + * @returns {DataTables.Api} Unmodified API instance + * + * @example + * // Show a processing indicator for two seconds on initialisation + * var table = $('#example').DataTable( { + * processing: true + * } ); + * + * table.processing( true ); + * + * setTimeout( function () { + * table.processing( false ); + * }, 2000 ); + */ + +jQuery.fn.dataTable.Api.register( 'processing()', function ( show ) { + return this.iterator( 'table', function ( ctx ) { + ctx.oApi._fnProcessingDisplay( ctx, show ); + } ); +} );