columns.search

Since: DataTables 3.0

Per column initial search configuration.

Description

This option can be used to set a search term for a column during initialisation. The search term can then be retrieved or updated via the column().search() API.

Please note that the value given for this option is an object, as defined by DataTable.SearchOptions to provide the full range of search options. As such the actual value to search on is given by the search property in the object.

Type

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

Default

  • Value: undefined

Examples

Apply a search on the first column during initialisation:

new DataTable('#myTable', {
	columnDefs: [{
		search: {
			search: 'My filter'
		},
		targets: 0
	}]
});

Applying a regex search on a column during initialisation:

new DataTable('#myTable', {
	columnDefs: [{
		{
			search: '^[0-9]+$',
			regex: true
		},
		targets: 4
	}]
});

Related

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