Column Filtering: when column is an array?
Example Data:
I have successfully done column filtering for regular strings:
status
. I have a Popover with checkbox that you can show or hide columns with that value.
I don't know how to handle teams
which is an arrya and get all UniqueValues.
Example of ColumnDef for status:
This is my enumFilterFn
, it does not work for arrays.
Markup: This is Svelte, but the logic basic and applies for all frameworks/lib.
1 Reply
rare-sapphireOP•4w ago
The
column.getFacetedUniqueValues()
works for basic status
column, but fails for arrays.
A thought I had was to check if each unique was an array and then combine all the values from each array, create a Set an to get uniqueValues, but I feel like isn't the right way. There has to be something simpler.
This is my table config.
I add on meta
an attribute filterType
to render correct markup. I think there is a way to make my enum
case to handle arrays instead of creating an enum-array
type. Maybe some way to pass a custom getFacetedUniqueValues
function for my array column?
This is solved