search

Since: DataTables 1.10

Search event - fired when the table is filtered.

Description

The search event is fired whenever the table's searching is triggered by the global search or columns search options, including calls from the API (search() for example). Additionally, a full redraw (by calling the draw()) method will cause the table to be re-searched.

Note that the search will be fired before the table has been redrawn with the updated filtered data, although the data will internally have been filtered.

Please note that, as with all DataTables emitted events, this event is triggered with the dt namespace. As such, to listen for this event, you must also use the dt namespace by simply appending .dt to your event name, as shown in the example below.

Type

function function( e, settings )

Parameters:

Example

Update an external input with filtering information using the API:

var table = $('#example').DataTable();

table.on( 'search.dt', function () {
	$('#filterInfo').html( 'Currently applied global search: '+table.search() );
} );

Related

The following options are directly related and may also be useful in your application development.