-
-
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
[DataGridPremium] Use valueGetter
to get row group keys
#16016
base: master
Are you sure you want to change the base?
Conversation
@@ -1605,7 +1605,7 @@ describe('<DataGridPremium /> - Row grouping', () => { | |||
expect(getColumnValues(1)).to.deep.equal(['', '0', '3', '', '1', '4', '', '2']); | |||
}); | |||
|
|||
it('should not use valueGetter to group the rows when defined', () => { | |||
it('should use valueGetter to group the rows when defined', () => { |
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.
It turned out that the current behavior was intentional.
I disagree with this, but maybe I don't see the full picture.
I know it's been 3 years 😅, but still – @flaviendelangle if you remember any additional details about this decision – please let me know 🙂
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.
We discussed it some time ago with @michelengelen and the problem is that I don't remember the reason why we did that 😆
But I remember we did it on purpose (maybe a bad one though).
Deploy preview: https://deploy-preview-16016--material-ui-x.netlify.app/ |
@@ -230,7 +231,7 @@ export const getCellGroupingCriteria = ({ | |||
if (groupingRule.groupingValueGetter) { | |||
key = groupingRule.groupingValueGetter(row[groupingRule.field] as never, row, colDef, apiRef); | |||
} else { | |||
key = row[groupingRule.field] as GridKeyValue | null | undefined; | |||
key = getRowValue(row, colDef, apiRef) as GridKeyValue | null | undefined; |
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.
When the row grouping is initially enabled, the public methods aren't yet assigned to apiRef
.
I extracted the getRowValue
method to a function so I can still call it here.
This doesn't change the fact that the apiRef
passed to valueGetter
won't have public methods assigned yet.
This makes me think that we should assign the methods (at least some of them) before initialization 🤔
mui-x/packages/x-data-grid-premium/src/DataGridPremium/useDataGridPremiumComponent.tsx
Line 165 in 2799763
useGridParamsApi(apiRef, props); |
WDYT?
Fixes #16015