-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Is there a way to determine if a table can horizontally scroll? #12234
Comments
@MartinTiangco I am almost 100% sure that we do not have a public API for this, however you could still do a manual calculation by targeting @romgrk you have worked on the scrolling recently ... do you have a better idea, or maybe a method readily available for this? |
For v7: const dimensions = apiRef.current.getRootDimensions()
const hasScroll = dimensions.columnsTotalWidth > dimensions.viewportOuterSize.width Needs to run in an effect, after the dimensions have been calculated. For v6, probably checking the |
@MartinTiangco would that be a sufficient solution for you? |
Hey thanks for the solutions. I used Just a followup: If grid resizing is a possibility, I attached these checks in the
|
No, that solution seems good. |
ok cool, thanks for the help! |
Sure, let us know if you need anything else. |
How did we do @MartinTiangco? |
Summary
Hey, is there a way (from the API?) to determine if a horizontal scrollbar is in the table (ie if there are columns that can't fit in the table and must be scrolled to).
I've searched through the issues and the doc and found nothing related to this. It would be a great convenience to have this.
Examples
No response
Motivation
The motivation is this interaction: https://www.behance.net/gallery/90059503/Complex-data-tables-on-mobile
If the user can horizontally scroll, then it would be good to have a pinned column (like shown in the attached link) that expands/shows all the columns of a row item in the detail view.
If all the table's columns can fit without horizontally scrolling, then there wouldn't be a need to have the expand pinned column.
Search keywords: horizontal scrollbar, scroll
The text was updated successfully, but these errors were encountered: