Skip to content
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

update viewportHeight when height changes (closes #120) #122

Merged
merged 3 commits into from
Mar 8, 2017

Conversation

veej
Copy link
Contributor

@veej veej commented Feb 23, 2017

as per issue #120, viewportHeight should be updated when height changes.

Description

Motivation and Context

Issue #120

How Has This Been Tested?

Modify ScrollToExample to receive width, height from local state. Initialize them to zero and update the size in componentDidMount.
Pass scrollToRow={0} when no row is found (like at first render).

Previous to this commit, fdt will start with scroll position > 0.
After this commit, fdt will start at the right scroll position.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

@bradbirnbaum
Copy link

I'm being impacted by this as well. I really need scrollToRow to work properly. Would appreciate merging and releasing this if it does indeed correct the issue. Thanks

// Number of rows changed, try to scroll to the row from before the
// change
var viewportHeight =
(props.height === undefined ? props.maxHeight : props.height) -
(props.headerHeight || 0) -
(props.footerHeight || 0) -
(props.groupHeaderHeight || 0);

var oldViewportHeight = this._scrollHelper._viewportHeight;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix the indent here

@KamranAsif
Copy link
Contributor

@veej @bradbirnbaum Sorry for the delay. I added a comment and forgot to hit start review /facepalm

@KamranAsif
Copy link
Contributor

Can you add a unit test for ensure we don't break this in the future? It should be very simple to copy this one and modify it slightly:

https://github.com/schrodinger/fixed-data-table-2/blob/master/src/FixedDataTableRoot-test.js#L94

@KamranAsif KamranAsif merged commit c981cc0 into schrodinger:master Mar 8, 2017
@KamranAsif
Copy link
Contributor

Published 0.7.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants