Parameters
useTableFilterState() takes one optional argument, in either of two shapes.
| Name | Type | Default | Description |
|---|
initial | TableFilterState | {} | The initial filter map itself. It is shallow copied, so the object you pass is never written to. |
initial.initialState | TableFilterState | {} | The same map behind an initialState key: useTableFilterState({ initialState }). A filter value is never an object, so a key named initialState with an object value can only be this form. |
Returns
| Name | Type | Description |
|---|
filters | Ref<TableFilterState> | The live filter map. Read filters.value for the current state. |
onFilterChange | (key: string, value: TableFilterValue | null) => void | Sets or clears one field. The map is replaced with a new object, so a getter over it stays in sync. |
clearAll | () => void | Empties the map. Every filter turns off at once. |
TableFilterState
| Name | Type | Description |
|---|
[fieldKey] | TableFilterValue | Field key to filter value. TableFilterValue is string | number | string[]. |