Skip to content

Fix <Datagrid> and <DataTable> bulk selection#10918

Merged
Madeorsk merged 2 commits intomasterfrom
fix-datagrid-datatable-bulk-selection
Sep 4, 2025
Merged

Fix <Datagrid> and <DataTable> bulk selection#10918
Madeorsk merged 2 commits intomasterfrom
fix-datagrid-datatable-bulk-selection

Conversation

@djhi
Copy link
Copy Markdown
Contributor

@djhi djhi commented Sep 4, 2025

Problem

When users select all rows matching their filters using the <SelectAllButton>, and then unselect rows using the <Datagrid> or <DataTable> header checkbox, all selected records are deselected instead of just the current page records.

Solution

Make sure only the currently displayed records are affected by the header checkbox.

How To Test

<Datagrid>

Story

  1. Set the Rows per page option to 5
  2. Select all records in the current page (either individually or using the header checkbox): You should have 5 selected records
  3. Click the Select all bulk actions button: You should have 7 selected records
  4. Click the header checkbox): You should have 2 selected records
  5. Click the cross button in the bulk actions banner: You should have 0 selected records

<DataTable>

Story

  1. Set the Rows per page option to 5
  2. Select all records in the current page (either individually or using the header checkbox): You should have 5 selected records
  3. Click the Select all bulk actions button: You should have 7 selected records
  4. Click the header checkbox): You should have 2 selected records
  5. Click the cross button in the bulk actions banner: You should have 0 selected records

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

Also, please make sure to read the contributing guidelines.

@djhi djhi added the RFR Ready For Review label Sep 4, 2025
Comment thread packages/ra-ui-materialui/src/list/datagrid/DatagridHeader.tsx Outdated
Comment thread packages/ra-ui-materialui/src/list/datatable/SelectPageCheckbox.tsx Outdated
@Madeorsk Madeorsk merged commit 168c171 into master Sep 4, 2025
24 of 25 checks passed
@Madeorsk Madeorsk deleted the fix-datagrid-datatable-bulk-selection branch September 4, 2025 16:51
@Madeorsk Madeorsk added this to the 5.11.1 milestone Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFR Ready For Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants