-
-
Notifications
You must be signed in to change notification settings - Fork 788
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
Make rowIndex and columnIndex optional #174
Conversation
src/createGridComponent.js
Outdated
horizontalScrollbarSize | ||
), | ||
scrollLeft: | ||
columnIndex !== undefined && columnIndex >= 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the >= 0
needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's not needed for this feature, but negative indexes will not produce valid results, especially with VariableSizeGrid
. I can remove the check if you prefer to leave the behaviour undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bvaughn Specifically, for VariableSizeGrid
, itemMetadata
will be undefined
, which will throw an error when calculating maxOffset
.
d4a9dec
to
665957e
Compare
@bvaughn Removed the |
// Scroll down to row 10, without changing scrollLeft | ||
rendered.getInstance().scrollToItem({ rowIndex: 10, align: 'auto' }); | ||
// Scroll left to column 0, without changing scrollTop | ||
rendered.getInstance().scrollToItem({ columnIndex: 0, align: 'auto' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You aren't testing anything between these scrollToItem
calls. That seems not great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops. I misremembered how my own tests were written 😆 you're expecting on the mock calls below. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks nice. Thanks
Just released with v1.7.0 |
Closes #173.
Update
scrollToItem
to makerowIndex
andcolumnIndex
optional. If unspecified (or invalid, e.g., negative value), the current value forscrollTop
orscrollLeft
will be used.