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

[DataGridPremium] Fix aggregated column resizing #10079

Merged

Conversation

cherniavskii
Copy link
Member

@cherniavskii cherniavskii commented Aug 18, 2023

@cherniavskii cherniavskii added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Aggregation Related to the data grid Aggregation feature labels Aug 18, 2023
@mui-bot
Copy link

mui-bot commented Aug 18, 2023

Netlify deploy preview

Netlify deploy preview: https://deploy-preview-10079--material-ui-x.netlify.app/

Updated pages

No updates.

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms -173.9 16.7 -4 -61.78 83.572
Sort 100k rows ms 881 1,495.3 1,415.2 1,293.68 216.049
Select 100k rows ms 709.8 795 753.6 759.16 31.803
Deselect 100k rows ms 148.8 271.3 178 193.82 42.248

Generated by 🚫 dangerJS against b45ee1f

@@ -232,17 +233,30 @@ export function useGridColumns(
(field, width) => {
logger.debug(`Updating column ${field} width to ${width}`);

const column = apiRef.current.getColumn(field);
const newColumn = { ...column, width };
apiRef.current.updateColumns([newColumn]);
Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't make much sense to call updateColumns to resize them, so I updated the implementation to calculate the new columns' width and update the state.

@cherniavskii cherniavskii marked this pull request as ready for review September 1, 2023 19:34
@@ -0,0 +1,55 @@
import * as React from 'react';
Copy link
Member

Choose a reason for hiding this comment

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

Off topic to this PR:
It could certainly be better to also move/resize the aggregation footer item with the resize (which happens on mouseout right now)
aggregation

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it's in a separate PR #10229

@cherniavskii cherniavskii merged commit 5cc4f8c into mui:master Sep 6, 2023
4 checks passed
@cherniavskii cherniavskii deleted the fix-resizing-aggregated-column branch September 6, 2023 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Aggregation Related to the data grid Aggregation feature feature: Column resize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGridPremium] Resizing aggregated column doesn't work
4 participants