-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[DataGridPremium] Server-side pivoting #19575
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
Conversation
Deploy preview: https://deploy-preview-19575--material-ui-x.netlify.app/ Updated pages:
Bundle size report
|
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.
docs review here - nicely done!
docs/data/data-grid/server-side-data/ServerSideDataGridAggregationPivoting.tsx
Outdated
Show resolved
Hide resolved
1610c4a
to
da5751d
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
da5751d
to
3f7ed42
Compare
c50a66c
to
b95e649
Compare
packages/x-data-grid-premium/src/hooks/features/dataSource/useGridDataSourcePremium.tsx
Outdated
Show resolved
Hide resolved
packages/x-data-grid-premium/src/hooks/features/dataSource/useGridDataSourcePremium.tsx
Show resolved
Hide resolved
packages/x-data-grid-premium/src/hooks/features/dataSource/useGridDataSourcePremium.tsx
Outdated
Show resolved
Hide resolved
packages/x-data-grid-premium/src/hooks/features/pivoting/gridPivotingInterfaces.ts
Outdated
Show resolved
Hide resolved
docs/data/data-grid/charts-integration/GridChartsIntegrationDataSource.js
Show resolved
Hide resolved
db48ab0
to
d51883d
Compare
packages/x-data-grid-premium/src/hooks/features/pivoting/gridPivotingInterfaces.ts
Outdated
Show resolved
Hide resolved
d51883d
to
0ad8eec
Compare
docs/data/data-grid/server-side-data/ServerSidePivotingColumnStructureComplex.tsx
Show resolved
Hide resolved
… for pivotingColDef. getPivotColDef not needed on the data source anymore
be0641c
to
6f9eb96
Compare
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.
Tiny tweaks—looking great!
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.
Great work 👏
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.
In this demo, adding anything to values
in pivoting section breaks it as there are no default aggregation functions:
Screen.Recording.2025-10-07.at.17.44.45.mov
Should we disable pivoting configuration panel with data source unless the required props for pivoting to work are provided?
Or at least improve the error message a bit:
diff --git a/packages/x-data-grid-premium/src/components/pivotPanel/GridPivotPanelField.tsx b/packages/x-data-grid-premium/src/components/pivotPanel/GridPivotPanelField.tsx
index d0ed78ba3..76f60f721 100644
--- a/packages/x-data-grid-premium/src/components/pivotPanel/GridPivotPanelField.tsx
+++ b/packages/x-data-grid-premium/src/components/pivotPanel/GridPivotPanelField.tsx
@@ -183,6 +183,12 @@ function AggregationSelect({
setAggregationMenuOpen(false);
};
+ if (!aggFunc) {
+ throw new Error(
+ `Aggregation function \`${aggFunc}\` not found, please provide a valid aggregation function`,
+ );
+ }
+
return (
<React.Fragment>
<rootProps.slots.baseChip
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 don't think that there should be an error, probably just hide it and warn about this on the pivoting page
We do the same for the aggregations dropdown in the column menu.
"Manage pivoting" should also be hidden.
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.
This can also happen without a data source if you override the default with an empty array.
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 have fixed the panel from crashing.
I am thinking now, since this kind of error also occurs on other premium demos with the data source
For example
https://mui.com/x/react-data-grid/server-side-data/aggregation/
The first demo here crashes if you try to group rows, because the input params are not read correctly, and the data source is not configured for that scenario.
Instead of us covering all these cases, is it better to show demos with disabled features or data sources supporting the feature so that the user can decide what they want to implement?
Automatically hiding UI elements might be confusing for the users, and we may still miss some use cases (present or in the future).
@mui/xgrid should I create another docs issue to check all demos and adjust where necessary?
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.
Created #19849 to cover other cases
Implemented the same for the demos that were part of this PR in 0cf8fc3
(#19575)
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 will merge the PR with these changes to have it ready for the release.
If needed, this can be changed in a different PR, since it is not an issue that originated with this feature.
packages/x-data-grid-premium/src/hooks/features/aggregation/useGridAggregation.ts
Show resolved
Hide resolved
Co-authored-by: Ale <[email protected]> Signed-off-by: Armin Mehinovic <[email protected]>
Co-authored-by: Ale <[email protected]> Signed-off-by: Armin Mehinovic <[email protected]>
Co-authored-by: Bilal Shafi <[email protected]> Signed-off-by: Armin Mehinovic <[email protected]>
Closes #10861
Preview: https://deploy-preview-19575--material-ui-x.netlify.app/x/react-data-grid/server-side-data/pivoting/
Updated section at: https://deploy-preview-19575--material-ui-x.netlify.app/x/react-data-grid/server-side-data/aggregation/#usage-with-pivoting