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 parameters search and escapeRegex (the latter is optional). 'null' is also accepted and the default will be used.

Type

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

Example

Set initial filtering on second and fourth columns:

$('#example').dataTable( {
  "searchCols": [
    null,
    { "search": "My filter" },
    null,
    { "search": "^[0-9]", "escapeRegex": false }
  ]
} );

Related

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