Accessing formatted cell value in custom global filter function #4295
Unanswered
greg-wiltshire
asked this question in
General
Replies: 1 comment
-
@greg-wiltshire did you ever find a solution? Thanks |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a react-table where I am supplying a custom global filter function. This is needed because in my case my data is a mixture of null | number | boolean | string | string[]. You can see an example of this here:
#4163
However in my column definition for the cell property I have a function that formats my data for presentation in the browser. For example I may have a ISO datetime string that I format into a more readable version using the dateFns package, or a float that needs to be converted to a string along with the currency. The user might want to legitimately search for "Jan" to get all January dates but at the moment they can not.
The issue is that the global filter function is only provided the row context as far as I can tell and from the row API I can not get the formatted value. Does anyone know if this is possible? I don't want to have to reapply the formatting in the global filter function, partly because of the overhead but also I need the column meta data to be able to do this (which is also unavailable in the row API).
The code has a renderValue function instead of a getValue function but there are some gaps in the documentation as to what this does and how to define the renderValue function.
Beta Was this translation helpful? Give feedback.
All reactions