React-table: Rows/Page changes do not scroll list to top.

Created on 24 Jan 2018  路  4Comments  路  Source: tannerlinsley/react-table

What version of React-Table are you using?

Your bug may already be fixed in the latest release. Run yarn upgrade react-table!
6.7.4

What bug are you experiencing, or what feature are you proposing?

When using a scrollable list with fixed headers and paging, changing the page or the rows/page does not scroll the list to the top. I believe it should. We worked around this by doing the scrollTop within onFetchData. Horizontal scrolling should (and does) get maintained.

Use https://codesandbox.io/s/X6npLXPRW (by clicking the "Fork" button) to reproduce the issue.

This issue can be seen using the react-table example...https://react-table.js.org/#/story/fixed-header-w-vertical-scroll

What are the steps to reproduce the issue?

  1. Increase rows to 20.
  2. Scroll to the bottom.
  3. Click Next to advance to the next page (or change rows to 25).
  4. Vertical scroll position is still at the bottom (should probably go to the top).

Regards,
Scott Alden (IQVIA)
scott.[email protected]

Most helpful comment

I Also have this problem.

@aldensc For a workaround i added to ReactTable props:
onPageChange={() => {
document.getElementsByClassName('rt-tbody')[0].scrollTop = 0;
}}

All 4 comments

I Also have this problem.

@aldensc For a workaround i added to ReactTable props:
onPageChange={() => {
document.getElementsByClassName('rt-tbody')[0].scrollTop = 0;
}}

Since this is a question of implementation we invite you to continue the conversation in the react tools slack organization. Thanks! https://react-chat-signup.herokuapp.com/

well it worked for me but If I do something like document.getElementsByClassName('rt-tbody')[1].scrollTo(0,0)

Any solution to this apart from following:

document.getElementsByClassName('rt-tbody')[0].scrollTop = 0;
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ggascoigne picture ggascoigne  路  18Comments

Codar97 picture Codar97  路  17Comments

vaidsu picture vaidsu  路  29Comments

schaeffer11 picture schaeffer11  路  24Comments

agray5 picture agray5  路  39Comments