search

Since: DataTables 2.0

Global search input.

Description

This feature displays a global search input next to a DataTable, letting the end user enter simple text search terms. The search behaviour can be customized with the search object.

The search feature can be disabled completely using the searching option or by excluding it from the layout options (which is the preferred method as of DataTables 2).

Multiple instances of this feature can be used on a single table. The inputs will be kept in-sync when the columns used for search match (search.columns) - i.e. a value from one will propagate to another - this can be useful if you wish to display a search input both at the top and the bottom of a table.

Examples

Disable search input with default layout:

new DataTable('#myTable', {
	layout: {
		topEnd: null
	}
});

Show search input top left:

new DataTable('#myTable', {
	layout: {
		topStart: 'search',
		topEnd: null
	}
});

Show search input with options:

new DataTable('#myTable', {
	layout: {
		topEnd: {
			search: {
				placeholder: 'Search here...'
			}
		}
	}
});

Related

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