Repository navigation
Replace rowGrouper with getRowGroupKey, rename groupIdGetter to getGroupId
#4159
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
941f6e6
Replace `rowGrouper` with `getRowGroupKey`
nstepien c64391a
Make `getRowGroupKey` optional
nstepien 23512d0
Split the grouping and flattening `useMemo`s
nstepien 6b27ad8
Use a module-level `WeakSet` to identify group rows
nstepien 84af607
Merge branch 'main' into replace-rowGrouper-with-getRowGroupKey
nstepien 6c050c0
Merge remote-tracking branch 'origin/main' into replace-rowGrouper-wi…
nstepien 3f33811
Test and document the group order
nstepien 27fcab4
Merge remote-tracking branch 'origin/main' into replace-rowGrouper-wi…
nstepien f1f7db0
Give the grouped rows a readonly type
nstepien 15bd69d
Compute `rowsCount` in the grouping `useMemo`
nstepien 3bf6c5e
Rename `groupIdGetter` to `getGroupId`
nstepien a2d1a4c
Merge remote-tracking branch 'origin/main' into replace-rowGrouper-wi…
nstepien 786d882
Fix expanding groups with too many rows to spread
nstepien aaf84d2
Let React Compiler compile `TreeDataGrid`
nstepien be7cef6
Sort the row grouping demo by the grouped columns
nstepien d3523d4
Check that the rows of a large expanded group are rendered
nstepien ec3a181
Document that `groupBy` should keep its identity
nstepien File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is it as flexible as
rowGrouper? Is there a case where users may want to have custom grouping logic?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.
I think the only "advantage" is that you could control the order of rows in a group with
rowGrouper, but I think it's better if we preserve the original row order.We previously used
Object.entrieswhich did not preserve the row order anyway.See the "Breaking changes" section in the PR description.
We can add a new
sortGroupRowsprop or other props if we ever need to.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.
Asked Claude to check, if you think none of them can be an issue then we can merge it.
For completeness, here's what
rowGrouperallowed thatgetRowGroupKeyno longer does, so we have it on record:Object.entriesonly reordered integer-like keys, so for string keys the order returned byrowGrouperwas kept. This also meant arowGrouperthat sorted its keys kept groups in place when rows were sorted withsortColumns.rowsby thegroupBycolumns firstrowsrowsfirstrowGrouperreceived all the rows of the parent group.getRowGroupKeyonly sees one rowgetRowGroupKey[].every()istrue.Uh oh!
There was an error while loading. Please reload this page.
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.
Sounds good?
For "empty groups", your Claude found no workaround, but we can implement nested rows with a custom behavior already:
https://comcast.github.io/react-data-grid/#/MasterDetail
https://comcast.github.io/react-data-grid/#/TreeView
We can revisit as needed.
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.
I'm also considering adding a
sortprop on columns, which should simplify a lot of stuff, and resolve some of these concerns.