Add Optional scrollRef
prop for having manual control over tableDivContainer
scroll position.
#880
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.
Related Issue
None
Description
This pull request adds a new prop,
scrollRef
that gives users access to the ref that handles the table's vertical scroll. (when the amount of items in the table exceeds the bodies height).Wanted to pitch this PR idea. We use this package at the company I work at and we wanted to make it so that paginating through the table always puts you at the top of the table when you switch pages. We looked for a prop or configurable parameter that would do that but couldn't find one 🥹.
I understand this prop is extremely specific to this one usecase so feel free to close MR if y'all feel it's not necessary
Related PRs
N/A
Impacted Areas in Application
material-table.js
, specifically the same place wheretableDivContainer
gets set. Does not impact any existing functionality by itself. May cause unexpected behavior if a user tries to do something crazy with their ref.Additional Notes
Here's an example of how this prop could be used- scrolling back to top of table body on page change.
Also removed an unused snapshot parameter in the drag-and-drop context callback but I can add that back in if need be.