T
TanStack17mo ago
narrow-beige

Search by name and email

I have a Name column in which I have name and email, Can anybody tell me how to make search by name and email?
No description
9 Replies
stormy-gold
stormy-gold17mo ago
in filterFns, you can access any data from the row from row.original
narrow-beige
narrow-beigeOP17mo ago
Please can you help i am having problem in this from many days Is there any example code that is available on web?
stormy-gold
stormy-gold17mo ago
What are you trying to do specifically that's not working? What is your accessor for this column?
narrow-beige
narrow-beigeOP17mo ago
accessor key is name
stormy-gold
stormy-gold17mo ago
Well, the filters will match whatever values are in the accessor
narrow-beige
narrow-beigeOP17mo ago
1. This column contains names and corresponding email addresses. 2. Now, I need to implement a search feature. How would you write the logic for input to search by both name and email? If you could envision this scenario as your own, how would you tackle it?
No description
narrow-beige
narrow-beigeOP17mo ago
@KevinVandy
optimistic-gold
optimistic-gold17mo ago
Instead of using accessorKey in your column definition use accessorFn: (row) => { /* do some concat of name and email */} now that both strings are in the accessor the table functions will use it to match against the input I would think.
stormy-gold
stormy-gold17mo ago
are you using a custom filterFn for that column? That would be a good use case for one

Did you find this page helpful?