-
-
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
[datagrid] autosizeColumns
does not work
#10510
Comments
autosizeColumns
does not work
@cherniavskii Why did you reopen this one? Did you notice the issue? @andymanitara Was this issue resolved for you? Were you using the right package? |
I wanted to check if it's reproducible and also see how column autosizing works with asynchronously loaded rows. |
@andymanitara I cannot reproduce the issue with this demo: https://codesandbox.io/s/lucid-roentgen-ynchfy?file=/Demo.tsx |
@romgrk One thing I noticed in the example above is that calling One workaround is to wrap Another option is to use How would you approach this use case? |
Sure but maybe open a new issue just for that concern?
My impression from this issue is that the author might have used the community package on which the |
Hey guys, yes I'm using the apiRef from the data grid, and I'm not using the community package. I'm using the I can't see how else I'm not getting that. I closed the issue because I ended up ignoring the autosizing feature for now, but it would be good to know. I see the autosize properties on the actual DataGridPremium component itself, just not in the apiRef & I'm definitely getting the |
@andymanitara That sounds really weird. Are you able to reproduce the issue in a live example? This codesandbox.io template may be a good starting point. |
https://codesandbox.io/s/distracted-ishizaka-mh8sv6?file=/demo.tsx I'd expect to see the autosizeColumns property on click, in the console I assume? Or does it require something else? The type doesn't even exist on the GridApiPremium it says for me too. I had issues using the |
I noticed this as well after our package-lock |
I think I just reproduced it. |
@andymanitara @charisseysabel Is this the same error you are experiencing? |
I'm using 6.0.15 of the |
Yep, that's the error for me. |
@andymanitara You need to use a version of the grid after the autosize feature was released. Can you test again with the latest version? Modifying your codesandbox to use |
@romgrk 6.0.15 looks good, that was the first release to include column autosizing https://github.com/mui/mui-x/releases/tag/v6.15.0 |
6.15.0 yes. 6.0.15 no. |
That's a typo on my end here, I was using 6.15.0 sorry (as per my opening post) - I have the autosizing props working on the actual DataGrid itself it's just that apiRef.autosizeColumns that doesn't exist for some reason. I can try on 6.16.1 to see if it makes a difference but it should be fine on 6.15.0 and for some reason doesn't work for me still on that version |
I've tried with the pro & premium packages, versions 6.15.0 and 6.16.1, and it's defined in both of them: @andymanitara Can you provide a reproducible codesandbox example? It's not possible for us to understand what's wrong otherwise. |
The issue has been inactive for 7 days and has been automatically closed. If you think that it has been incorrectly closed, please reopen it and provide missing information (if any) or continue the last discussion. |
The problem in depth 🔍
Hi,
I'm using the latest version of the DataGrid to test out the new autosize feature. The way I use the grid, is once the data comes back from an endpoint we populate the grid. So I was looking to use the apiRef to call apiRef.current.autosizeColumns()
However, it tells me that autosizeColumns doesn't exist and when I log out the entirety of apiRef.current it doesn't exist as a property on the object.
From the documentation, I've tried to understand why it doesn't show or why the autosize doesn't work but I couldn't find an answer. We currently give our columns a set width, would that impact it in any way? Or are there any other props that we could be using in our grid that could stop the autosize from working outside of the dynamic row height which we aren't using?
I'm not sure if I just haven't fully installed something, or was supposed to update another package too but I've only upgraded from 6.14.0 to 6.15.0
Thanks for your help,
Andy
Your environment 🌎
npx @mui/envinfo
Search keywords: autosizeColumns
The text was updated successfully, but these errors were encountered: