-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolves Issue #1689: Adding filter count to column headers #1760
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @SiddharthParatkar! Can you also please update the PR description with the screenshots of your changes in action once you are done?
/** Create a mapping between the column names and the number of filters selected for that count. */ | ||
const columnFilterCount: { [key: string]: number; } = {} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work correctly if there are multiple tables with same filter names on a page. Let's use the existing filters if possible instead.
? " (9+) " | ||
: " (" + columnFilterCount[c.key] + ") " | ||
: "" | ||
c.name = c.name.substring(0, c.key.length) + filterCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding the filter count to the col name, we would like to have it as a separate square in the top right corner relative to the filter chevron so that it's clear that the number belongs to the filters.
@@ -965,7 +984,7 @@ export const | |||
sort, | |||
isMultiple, | |||
setFiltersInBulk | |||
}), [filteredItems, groups, expandedRefs, isMultiple, items, m, onFilterChange, selectedFilters, selection, sort, setFiltersInBulk]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
@SiddharthParatkar are you going to finish this or may I close this PR? |
I don't think I'll be able to finish, sorry. |
This PR resolves issue #1689. When a filter is selected for a column that is instantiated with
filterable=True
, this feature will automatically add a number for how many filters are applied to that column. For 0 filters, no number will be shown; for more than 9 filters, '9+' will be shown.