Skip to content
Discussion options

You must be logged in to vote

I have it working but seems a bit ugly to me.

I removed the InitialState.filters option and passed an initialValue to the GlobalFilter. Small bug is that if the global filter input is cleared then the initial value is used. Will fix that though.

// Define a default UI for filtering
function GlobalFilter({
preGlobalFilteredRows,
globalFilter,
setGlobalFilter,
initialSearch
})
{
const count = preGlobalFilteredRows.length
const [value, setValue] = React.useState(globalFilter)
const onChange = useAsyncDebounce(value => {
setGlobalFilter(value || undefined)
}, 200)
if (!value && initialSearch) {
setValue(initialSearch)
onChange(initialSearch)
}
return (
<Input
value={value || initialSearch}
on…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gplatt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant