-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Allow to select range of rows with shift key #2456
Conversation
There's this |
This method seems buggy |
I was convinced I fixed this one...my bad if it is not. I will take a look |
@m4theushw #2456 (review) is done 👍 |
packages/grid/_modules_/grid/components/columnSelection/GridCellCheckboxRenderer.tsx
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/accessibility/accessibility.md
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/getting-started/getting-started.md
Outdated
Show resolved
Hide resolved
if (selectedRowsIds.length > 0) { | ||
const selectedRowsIndex = selectedRowsIds.map((id) => apiRef.current.getRowIndex(id)); | ||
const startRowIndex = Number(rowEl.getAttribute('data-rowindex')); | ||
const startId = apiRef.current.getRowIdFromRowIndex(startRowIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Selecting filtered rows with the keyboard is not working. The ID has to come from the selector, not from apiRef.current.getRowIdFromRowIndex
.
packages/grid/_modules_/grid/components/columnSelection/GridCellCheckboxRenderer.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/hooks/features/selection/useGridSelection.ts
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/hooks/features/selection/useGridSelection.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
…arted.md Co-authored-by: Matheus Wichman <matheushw@outlook.com>
…y.md Co-authored-by: Matheus Wichman <matheushw@outlook.com>
packages/grid/_modules_/grid/components/columnSelection/GridHeaderCheckbox.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/hooks/features/selection/useGridSelection.ts
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/hooks/features/selection/useGridSelection.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
Shift
Shift
apiRef.current.selectRowRange
to handle in a single place the keyboard and mouse range selection behaviorCloses #1858
Preview: https://deploy-preview-2456--material-ui-x.netlify.app/components/data-grid/selection