Repository navigation
[FEATURE] Support per-column value filtering in the Table component - #425
adrianSepiol wants to merge 5 commits into
Conversation
d489a21 to
47e52e6
Compare
…able headers Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
47e52e6 to
c839b22
Compare
| display: 'flex', | ||
| flexWrap: 'nowrap', | ||
| flexDirection: 'row', | ||
| justifyContent: 'space-between', |
There was a problem hiding this comment.
nit: This changes all previous headers that were center aligned to left aligned, for example actions. Should we apply this kind of alignment only when the filter is enabled?
There was a problem hiding this comment.
addressed in 570f688 should work as before
| sx={styles.search} | ||
| /> | ||
| <Divider /> | ||
| <List dense disablePadding aria-labelledby={labelId} sx={styles.list}> |
There was a problem hiding this comment.
Can this list get big enough that would require virtualization?
There was a problem hiding this comment.
There might be a lot of entries, I've added virtualization in efe5c3f
| const [searchKey, setSearchKey] = useState(0); | ||
|
|
||
| const sortedEntries = useMemo( | ||
| () => [...uniqueValues.entries()].toSorted(([a], [b]) => String(a).localeCompare(String(b))), |
There was a problem hiding this comment.
if we just use local compare numbers will be sorted as text
| const handlePopoverClick = useCallback((e: React.MouseEvent) => e.stopPropagation(), []); | ||
| const handlePopoverKeyUp = useCallback((e: React.KeyboardEvent) => e.stopPropagation(), []); | ||
|
|
||
| const handleToggleAll = useCallback((): void => { |
There was a problem hiding this comment.
When a filter is selected and then the table data changes to values that do not contain the value in the filter, it seems the table still filters with the non existent value, leading to an empty table and the filter no longer on the list to uncheck it. Clearing all does not reset the filter correctly so the table is filtered with probably 0 results without a way to clearing them.
There was a problem hiding this comment.
fixed in e85b6bd. It is now possible to filter out old values:
Screen.Recording.2026-11-10.at.13.39.11.mov
Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
…mixed value types Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
…r values and update selection behavior Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
53c1f39 to
e85b6bd
Compare
Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
Description
Needed for: perses/perses#4607
Adds an opt-in column filter to table headers. Columns with enableColumnFilter: true render a filter icon that opens a searchable, checkbox-list popover of the column's unique values; selecting values filters the rows.
This brings column filtering into the shared Table and enables plugins/table to drop its custom filtering implementation. Today TablePanel hand-rolls its own ColumnFilterDropdown, columnFilters state, filteredData memo, and a filter row kept in horizontal sync via refs.
To test it with tags column update TAGS_COLUMN in DashboardTreeList.tsx with this properties:
Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes
See e2e docs for more details. Common issues include: