You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building a list filter in which all the unique values of a column will be displayed and the user will pick which of them they want to filter out (pretty much like Excel's filters). My filter component will iterate the preFilteredRows in order to fetch the rows and reduce them into unique values.
My problem is when this column defines a custom Cell function to format the cell's value I can't find a way to get the formatted value. preFilteredRows only contains the original (pre-formatted) values.
{Header: 'Country',accessor: 'address',Cell: ({ value })=>value.country,Filter: ListFilter,},
if my ListFilter component tries to fetch the cells' values via iterating preFilteredRows I'll get the pre-formatted address object and not the post-formatted country string. I can't find any property containing the formatted value (I assume they are only getting formatted during cell rendering) or the correct way to manually call the Cell function to fetch the formatted value.
My last resort is to make my ListFilter component a HoC in which I have to (re)define the formatting function like this:
{Header: 'Country',accessor: 'address',Cell: ({ value })=>value.country,Filter: ListFilter(({ value })=>value.country),},
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am building a list filter in which all the unique values of a column will be displayed and the user will pick which of them they want to filter out (pretty much like Excel's filters). My filter component will iterate the preFilteredRows in order to fetch the rows and reduce them into unique values.
My problem is when this column defines a custom Cell function to format the cell's value I can't find a way to get the formatted value. preFilteredRows only contains the original (pre-formatted) values.
F.e let's say we have the following dataset:
and I define a column Country like this:
if my ListFilter component tries to fetch the cells' values via iterating preFilteredRows I'll get the pre-formatted address object and not the post-formatted country string. I can't find any property containing the formatted value (I assume they are only getting formatted during cell rendering) or the correct way to manually call the Cell function to fetch the formatted value.
My last resort is to make my ListFilter component a HoC in which I have to (re)define the formatting function like this:
Beta Was this translation helpful? Give feedback.
All reactions