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, the event object has a DataTables API instance available on it in the dt property.

Type

function( e, settings )

Parameters:

Example

Update an external input with filtering information using the API:

var table = new DataTable('#myTable');

table.on('search.dt', function () {
	document.querySelector('#filterInfo').textContent =
		'Currently applied global search: ' + table.search());
});

Related

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