searchCols
Define an initial search for individual columns.
Deprecated!
As of v3.0.0 this feature has been deprecated. This feature has not yet been scheduled for removal, but its use is discouraged and the alternatives discussed below should be used.
As of DataTables 3, the columns.search option is preferred over this option. The advantage of columns.search is that the search is more tightly coupled to the column and in combination with columnDefs you do not need to specify a value for every column.
This option is still supported, but you are encouraged to use columns.search.
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 DataTable.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.