-
-
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
[data grid] Column autosizing calculated on old data instead of new data #12940
Comments
I'm unable to reproduce an issue with the steps above, would it be possible to explain which steps to take to experience any of the issues you list? |
Please have a look at the example here https://stackblitz.com/edit/react-e7tkn5. After retrieval of the data the CSS var Some examples: First data retrieval after opening the example, the header and hover backgrounds of the community version do not cover the "Branding", "Representative" and "Rating" columns on the far right: After clicking refetch data, or the widest row is wider thus the header and hover backgrounds does not cover the "Rating" column on the far right: |
Still can't reproduce, can you fill the env info section? You have the instructions in the top comment. |
I have added the env info section in the top comment |
@mui/xgrid Can someone on macOS take this one? Might have an impact. |
I'll check it out. |
After a few tries, I was finally able to reproduce this error. It didn't reproduce so easily for me. To reproduce I needed to meet these conditions:
When it reproduces, this mui-x/packages/x-data-grid/src/hooks/features/dimensions/useGridDimensions.ts Lines 306 to 324 in 7566a1d
Since the I suspect it's because of the non-reactive nature of the @froons can you reproduce it consistently or on a specific screen width? Also which browser do use to reproduce it? Update: I tried to make the dimensions reactive and the error doesn't reproduce for me anymore. |
@MBilalShafi To answer the first question, I am able to reproduce it consistently using Chrome and Safari where the table has to be wider than the screen width. |
@Frooons: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Steps to reproduce
Link to live example: https://stackblitz.com/edit/react-e7tkn5?file=Demo.tsx
Current behavior
The community version of data grid uses the old data set to set the
--DataGrid-rowWidth
css variable when using the autosizeColumns functionality, resulting in inconsistencies between the header and data rows.Row exceeds header length:
Header exceeds row length:
The pro version does set the
--DataGrid-rowWidth
based on the new data, as shown in the screenshot below. The pro version above the community version below, both using the same data but different widths:Expected behavior
The community version should also set the
--DataGrid-rowWidth
based on the new data just like the pro version does.Context
The live example is a fork of autosizing asynchronously with extended data and the community version added below to the pro version, both use the same logic to retrieve the data and execute the autosizeColumns.
With the browser inspector open, clicking the refresh button I see the style attribute of the
MuiDataGrid-root
div refreshed immediately for the community version which is too soon. With the pro version the style attribute of theMuiDataGrid-root
div is refreshed after the new data is loaded.Your environment
npx @mui/envinfo
Search keywords: Autosizing
The text was updated successfully, but these errors were encountered: