T
TanStack2y ago
plain-purple

React table filtering

Hi im using "react-table": "^7.8.0" with global filtering, how can i apply a custom filter that will treat dots and commas as the same ? Also how can i do this if i have a filter on all of my columns ? '''' function GlobalFilter({ preGlobalFilteredRows, globalFilter, setGlobalFilter }) { const count = preGlobalFilteredRows.length; const [value, setValue] = React.useState(globalFilter); const [isKeyboardVisible, setKeyboardVisible] = useState(false); const ref = useOnclickOutside(() => { setKeyboardVisible(false); }); const onChange = useAsyncDebounce((value) => { setValue(value); setGlobalFilter(value undefined); }, 200); return ( <span className="all-search-span" ref={ref}> Search:{' '} <input className="table-input" value={value ""} onClick={() => { setKeyboardVisible(true); }} onChange={(e) => { setValue(e.target.value); onChange(e.target.value); }} placeholder={Search: ${count}...} style={{ fontSize: '1.1rem', border: '0', }} /> </span> ) } ''''
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?