useGlobalFilter is the hook that implements global row filtering – in other words, filtering based upon data that may be in any column in a given row. This is often useful as a free-text search across all columns simultaneously. It can be used in conjunction with
useFilters, which involves filtering based upon data in specific columns. It is important to note that this hook can be used either before or after
useFilters, depending on the performance characteristics you want to code for.
The following options are supported via the main options object passed to
globalFilter: String | Function(rows: Array<Row>, columnIds: Array<ColumnId: String>, globalFilterValue) => Rows
stringis passed, the function with that name will be used from either the custom
filterTypestable option (if specified) or used from the built-in filtering types object.
rowsto filter, an array of
columnIds(being the column IDs that global filtering is being applied to), and
globalFilterValue, being the current value of the global filter
Arrayof rows, being the remaining rows that have not been filtered out according to the
filterTypes: Object<filterKey: filterType>
globalFiltertype isn't found on this object, the table will default to using the built-in filter types.
globalFilterstate will automatically reset if any of the following conditions are met:
The following options are supported on any
Column object passed to the
columns option in
true, global filtering will be disabled for this column
The following values are provided to the table
globalFiltervalue, located on the state object.
rowsdo not contain every possible option.
setGlobalFilter: Function(filterValue) => void