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] Make checkboxSelection respect the disableMultipleRowSelection prop #11448

Merged
merged 13 commits into from
Dec 22, 2023

Conversation

cherniavskii
Copy link
Member

@cherniavskii cherniavskii commented Dec 18, 2023

@cherniavskii cherniavskii added component: data grid This is the name of the generic UI component, not the React module! feature: Selection Related to the data grid Selection feature labels Dec 18, 2023
@mui-bot
Copy link

mui-bot commented Dec 18, 2023

Comment on lines +10 to +15
if (props.signature === GridSignature.DataGrid) {
// DataGrid Community has multiple row selection enabled only if checkbox selection is enabled.
return props.checkboxSelection && props.disableMultipleRowSelection !== true;
}
return !props.disableMultipleRowSelection;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bit messy, but the main change in this PR is that you can now pass the disableMultipleRowSelection prop to MIT DataGrid.
The default behavior hasn't changed, so this PR does not bring any breaking changes.

@cherniavskii cherniavskii added customization: logic Logic customizability enhancement This is not a bug, nor a new feature labels Dec 20, 2023
@cherniavskii cherniavskii marked this pull request as ready for review December 20, 2023 21:07
Copy link
Member

@MBilalShafi MBilalShafi left a comment

Choose a reason for hiding this comment

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

Feels more natural now 👍

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 21, 2023
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 Dec 22, 2023
@cherniavskii cherniavskii enabled auto-merge (squash) December 22, 2023 14:30
@cherniavskii cherniavskii merged commit b12f0c5 into mui:next Dec 22, 2023
15 checks passed
@cherniavskii cherniavskii deleted the checkboxSelection-single-row-limit branch December 22, 2023 14:34
@Ciframa
Copy link

Ciframa commented Mar 25, 2024

Does it work with Data-Grid-Pro for u guys?

@cherniavskii
Copy link
Member Author

@Ciframa Sure, here's a demo: https://stackblitz.com/edit/react-bvyzcm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! customization: logic Logic customizability enhancement This is not a bug, nor a new feature feature: Selection Related to the data grid Selection feature v7.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Allow disabling multiple row selection with checkbox selection enabled
4 participants