-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[DataGridPro] Support pinned columns and dynamic row height #5782
Merged
m4theushw
merged 10 commits into
mui:master
from
m4theushw:dynamic-row-height-column-pinning
Sep 1, 2022
Merged
[DataGridPro] Support pinned columns and dynamic row height #5782
m4theushw
merged 10 commits into
mui:master
from
m4theushw:dynamic-row-height-column-pinning
Sep 1, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These are the results for the performance tests:
|
2 tasks
packages/grid/x-data-grid-pro/src/components/DataGridProVirtualScroller.tsx
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
cherniavskii
approved these changes
Sep 1, 2022
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
component: data grid
This is the name of the generic UI component, not the React module!
plan: Pro
Impact at least one Pro user
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Preview: https://deploy-preview-5782--material-ui-x.netlify.app/x/react-data-grid/column-pinning/#usage-with-dynamic-row-height
Closes #5137
The approach I took was to split the
base
size stored inrowsHeightLookup
to also store the size for the other row components that make part of a single row. Now we have:baseLeft
: base size for the cells from the left pinned columnsbaseCenter
: base size for the cells from the center, it's the oldbase
sizebaseRight
: base size for the cells from the right pinned columnsWhen we calculate the content size we check all base sizes, using a regex, and take the biggest. To make all row components to look aligned I use
minHeight
with the value calculated earlier. This is also one trade-off of this solution: if the content changes and the new row height is smaller it won't be reflected. This happens because the minimum height forces the row to have that minimum size, also impacting theResizeObserver
measurements. As solution, I added an API method to reset the heights.