Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

SiddharthParatkar
Copy link

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.

Copy link
Collaborator

@mturoci mturoci left a 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?

Comment on lines +28 to +30
/** Create a mapping between the column names and the number of filters selected for that count. */
const columnFilterCount: { [key: string]: number; } = {}

Copy link
Collaborator

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
Copy link
Collaborator

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])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

@mturoci
Copy link
Collaborator

mturoci commented Jan 9, 2023

@SiddharthParatkar are you going to finish this or may I close this PR?

@SiddharthParatkar
Copy link
Author

I don't think I'll be able to finish, sorry.

@mturoci mturoci closed this Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants