-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[DataGridPremium] Fix aggregated column resizing #10079
Conversation
Netlify deploy previewNetlify deploy preview: https://deploy-preview-10079--material-ui-x.netlify.app/ Updated pagesNo updates. These are the results for the performance tests:
|
@@ -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]); |
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 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.
packages/grid/x-data-grid-pro/src/hooks/features/columnResize/useGridColumnResize.tsx
Show resolved
Hide resolved
packages/grid/x-data-grid/src/hooks/features/columns/useGridColumns.tsx
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,55 @@ | |||
import * as React from 'react'; |
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.
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.
Yes, it's in a separate PR #10229
Fixes #10078
Before: https://codesandbox.io/s/sleepy-tom-dfqv28
After: https://codesandbox.io/s/elated-elgamal-wjzw9j
TODO: