{hero}

column().search.fixed()

Since: DataTables 2.0

Get / set a named search to apply to a column.

Description

Just as search.fixed() applies a "fixed" search term to the whole table, this method can be used to apply a search term to a specific column.

The fixed search (which might also be termed sticky or named searches) provides a way to easily add cumulative search terms to the table. You can add multiple independent search terms, and DataTables will combine them (AND logic) displaying the result of all search terms that have been applied.

Please be aware that this method sets the fixed search to apply to the column only - it does not actually perform the search. In order to have the search performed and the result shown, use the draw() method, which can be called simply as a chained method of this method.

Types

function column().search.fixed()

Description:

Get a list of the names of searches applied to the column.

Returns:

An API instance that contains the names of the search terms applied to the column.

function column().search.fixed( name )

Description:

Get the search term used for the given name.

Returns:

The search term that was originally applied.

function column().search.fixed( name, searchTerm )

Description:
Parameters:
Returns:

DataTables API instance

Examples

Get an array of current search names:

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

let searches = table
	.column(0)
	.search.fixed()
	.toArray();

Get an expecting search term:

let search = table.column(1).search.fixed('mySearch');

Applying a search string:

table.column('.cities').search.fixed('myString', 'Paris');

Applying a search regex:

table.column(0).search.fixed('myRegex', /l.*n/i);

Applying a search function:

table.column(-1).search.fixed('myFunc', (cell, data) => {
	return cell > 50;
});

Deleting an existing search term:

table.column(0).search.fixed('mySearch', null);

Related

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