column().columnControl.searchClear()
Remove any ColumnControl applied search from the selected column.
Please note - this property requires the ColumnControl extension for DataTables.
Description
ColumnControl's search controls have UI elements that allow the end user to quickly clear a search term, but you might also wish to do this using external controls. This method provides a programmatic way to clear a search term that was added by ColumnControl to a selected column. searchList
and input based search content types (e.g. searchText
) will all be cleared by this method.
Note that the table will not be automatically redrawn when this method has been called. You need to call draw()
to display the changes as a result of the updated search.
Type
column().columnControl.searchClear()
Remove any search that was applied to the column via ColumnControl inputs.
Returns:
DataTables.Api
:
API instance that contains a reference to the selected column.
Example
Remove ColumnControl applied search terms from column index 0:
let table = new DataTable('#myTable', {
columnControl: ['order', 'searchDropdown']
});
document.querySelector('#clearColumn0').addEventListener('click', () => {
table.column(0).columnControl.searchClear();
});
Related
The following options are directly related and may also be useful in your application development.