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

[DataGrid] Update selected rows when turning off checkboxSelection #3684

Merged
merged 5 commits into from
Jan 27, 2022

Conversation

m4theushw
Copy link
Member

@m4theushw m4theushw commented Jan 20, 2022

Steps to reproduce

  1. Open https://codesandbox.io/s/datagriddemo-material-demo-forked-pmz9e?file=/demo.tsx
  2. Select two or more rows
  3. Click "Toggle checkbox selection"
  4. The rows stay selected even on DataGrid, which doesn't support multiple selection without checkboxSelection

Proposed solution

If checkboxSelection is turned off, then we clean selectionModel to keep only one row selected.

CodeSandbox with the fix: https://codesandbox.io/s/datagriddemo-material-demo-forked-jjoyn?file=/demo.tsx

@mui-bot
Copy link

mui-bot commented Jan 20, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 145.8 390.5 211.5 253.62 107.458
Sort 100k rows ms 297.1 631.7 515 492.54 118.521
Select 100k rows ms 151.5 299 202.9 224.68 52.788
Deselect 100k rows ms 85.9 298 206.9 182.16 71.291

Generated by 🚫 dangerJS against 22de2b4

@m4theushw m4theushw added the component: data grid This is the name of the generic UI component, not the React module! label Jan 20, 2022
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 24, 2022
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 24, 2022
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 24, 2022
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 24, 2022
@m4theushw m4theushw marked this pull request as ready for review January 25, 2022 00:13
@m4theushw m4theushw added the bug 🐛 Something doesn't work label Jan 25, 2022
@m4theushw m4theushw self-assigned this Jan 25, 2022

const firstSelectableRow = currentSelection.find((id) => {
let isSelectable = true;
if (typeof isRowSelectable === 'function') {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (typeof isRowSelectable === 'function') {
if (isRowSelectable) {

Like in line 479. I was looking for what are the other types of isRowSelectable

@m4theushw m4theushw merged commit 0a39ac6 into mui:master Jan 27, 2022
@m4theushw m4theushw deleted the update-selected-rows branch January 27, 2022 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants