T
TanStack•2y ago
harsh-harlequin

Filter table by more than one column

Hi everyone, I'm looking to filter an existing table by more than one column. At the moment I have the following Input component that filters the table by the UPN column:
<Input
placeholder='Filter by UPN'
value={(table.getColumn('upn')?.getFilterValue() as string) ?? ''}
onChange={event => table.getColumn('upn')?.setFilterValue(event.target.value)}
className='max-w-sm'
/>
<Input
placeholder='Filter by UPN'
value={(table.getColumn('upn')?.getFilterValue() as string) ?? ''}
onChange={event => table.getColumn('upn')?.setFilterValue(event.target.value)}
className='max-w-sm'
/>
Ideally I'd like to add another column to filter by for this, is this something that could be simply done? Thanks 🙂
6 Replies
harsh-harlequin
harsh-harlequinOP•2y ago
Just wondering if anyone could possibly help with this at all?
eager-peach
eager-peach•2y ago
Could you just add another input to filter by the second column? I'm not sure I understand the question
harsh-harlequin
harsh-harlequinOP•2y ago
I was wodnering if it was that simple, you might be right. I have a table with multiple columns at the moment and the filter input only filters the UPN column, There is also an ID column which I would like to include in the filter
eager-peach
eager-peach•2y ago
There is also a global filter that can filter the whole table based on a filter function
harsh-harlequin
harsh-harlequinOP•2y ago
oooh is there? Could you please provide me a link?
eager-peach
eager-peach•2y ago
Filters | TanStack Table Docs
Can-Filter The ability for a column to be column filtered is determined by the following:

Did you find this page helpful?