globalFilter by returned value from Cell() #3229
Unanswered
J-P-Dorman
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, this seems like it would be a very common use case so maybe I'm misunderstanding something here.
I'm writing a custom globalFilter function and within it would like to search by the rendered value the user can see, rather than the raw data I passed into the table.
For example if I pass in
35
in the data and in the Cell function return£35.00
- the user will expect a global filter value of£35
to return this row.(It's important the raw data is a numerical value instead of the string '£35' as I'll be using this number for aggregation etc later)
So far I've been reaching into
rows > row > cells > cell > Cell()
to format the value for my search.But this is a flawed approach as rows aren't always prepared, meaning cell is sometimes empty, breaking my search.
Also the Cell() function may not always return a string, which brings me back to square one.
My current, flawed approach:
(using lodash's get: https://lodash.com/docs/4.17.15#get)
Surely there's some way to instead pass a callback alongside Cell() on the columns that defines what value you want the filter to see, or something to this effect? I've checked the docs but maybe I've scrolled past something important?
Beta Was this translation helpful? Give feedback.
All reactions