search.columns
Limit the search to a specific subset of columns.
Description
It can sometimes be desirable to limit the search input for the table to a specific subset of columns. This option provides that ability.
Please note that there is some overlap with columns.searchable here - that option can be used to disable search completely for a column. This option, and the search APIs provides more nuance. For example, you might wish to have the main search input operate on a particular set of columns, but also allow a custom API search of a column not included in that set. That isn't possible with columns.searchable, but can be achieved here.
This option accepts all of the options available through DataTable.ColumnSelector. It is important to note that the selection of columns is performed when the search feature is initialised. If DOM properties change at a later time (e.g. a class selector is used), the columns selected for this control will not be updated.
Furthermore, this feature uses shares the same methods as columns().search(). As such, while it is possible to have multiple instances of this feature, if you want them to search independently of each other, you must select a different set of columns for each control. If the control selects the same columns as another, they will be kept in-sync. Moreover, use of the columns().search() method will effect this control if the selected columns match.
Type
This option can be given in the following type(s):
Default
- Value:
*
Select all columns.
Example
Show the processing indicator when searching large data sets:
new DataTable('#myTable', {
layout: {
topEnd: {
search: {
columns: [0,1]
}
}
}
});Related
The following options are directly related and may also be useful in your application development.