The Filter API in v8 has been replaced with a structured FilterState that supports multiple operators, two conditions per column, and explicit Apply semantics.
DataTable Props
filterValues and onFilterChange now use FilterState instead of string:
filterValues?: Record<string | number, FilterState>onFilterChange?: (columnId: string | number, filter: FilterState) => void
TableColumn Props
Set filterType on a column to define the available operators and input widget. Supported values are 'text' (default), 'number', and 'date'. The filterFunction now receives FilterState as its second argument.
FilterState Structure
type FilterState = {
condition1: { operator: FilterOperator; value?: string; value2?: string };
condition2?: { operator: FilterOperator; value?: string; value2?: string };
logic?: 'AND' | 'OR'; // defaults to 'AND'
};
Behavior
Filters no longer apply on every keystroke. Users must click an Apply button to trigger onFilterChange. The clear action still clears immediately.
Utilities
emptyFilterState(type: 'text' | 'number' | 'date'): Creates a default empty state.isFilterActive(state: FilterState): Returns true if the filter has an active condition.
import type { FilterState } from 'react-data-table-component';
// TableColumn configuration
const columns: TableColumn<Row>[] = [
{
id: 'age',
name: 'Age',
selector: r => r.age,
filterable: true,
filterType: 'number'
},
];
// filterFunction implementation
{
filterable: true,
filterType: 'text',
filterFunction: (row, filter) => {
const v = filter.condition1.value ?? '';
return row.name.toLowerCase().startsWith(v.toLowerCase());
},
}