{hero}

searchCols

Since: DataTables 1.10

Define an initial search for individual columns.

Description

Basically the same as the search option, but in this case for individual columns, rather than the global filter, this option defined the filtering to apply to the table during initialisation.

The array must be of the same size as the number of columns, and each element be an object with the optional parameters defined by DataTables.SearchOptions. null is also accepted and the default will be used. See the search documentation for more information on these parameters.

Type

This option can be given in the following type(s):

Example

Set initial filtering on second and fourth columns:

new DataTable('#myTable', {
	searchCols: [
		null,
		{ search: 'My filter' },
		null,
		{ search: '^[0-9]', regex: true }
	]
});

Related

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