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

DataTable's "Select all..." label in BaseSelectionStatus shows incorrect counts #2872

Closed
4 tasks
adamstankiewicz opened this issue Nov 28, 2023 · 1 comment · Fixed by #2929
Closed
4 tasks
Assignees
Labels
bug Report of or fix for something that isn't working as intended

Comments

@adamstankiewicz
Copy link
Member

Bugs

There appears to be a bug/regression related to DataTable and the "Select all" label in the BaseSelectionStatus component, introduced by this PR, which seemed to separately resolve a different bug.

As seen on the Paragon documentation site, when selecting a row using the DataTable.ControlledSelect* sub-components, the "Select all..." label incorrectly says "Select all 3" when there are 7 rows total.

image

I believe the issue is related to this line:

const filteredItems = filteredRows?.length || itemCount;

It appears that even without any filters applied, filteredRows comes back with an array containing the rows for current page, preventing the itemCount from being shown.

Adjusting the logic to include hasAppliedFilters resolves this particular issue:

const filteredItems = (hasAppliedFilters && filteredRows?.length) || itemCount;

However, it does appear that when a filter is applied, the "Select all..." count is still not quite correct when using the DataTable.ControlledSelect* components. For example, this below table has 60 rows total without any filters ("Select all 60" ✅ ); with a filter applied for "Status" column, there are now 55 rows total (itemCount) but it would state "Select all 25" ⛔ (since the visible page has 25 rows):

image

Tasks

Preview Give feedback
@PKulkoRaccoonGang
Copy link
Contributor

PR: #2929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report of or fix for something that isn't working as intended
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants