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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to automatically scroll to the top in the rsuite table? #365

Open
lomse opened this issue Sep 1, 2022 · 1 comment
Open

How to automatically scroll to the top in the rsuite table? #365

lomse opened this issue Sep 1, 2022 · 1 comment

Comments

@lomse
Copy link

lomse commented Sep 1, 2022

What problem does this feature solve?

I'm using the rsuite table and the rsuite pagination components (sweet components 馃憦).
I'm facing a situation where I need to scroll to the top the table after click moving from one page to the other.

I see the scrollTop table method but I'm not too sure how to use it.

I also see the shouldUpdateScroll props which I tried with the code below but it doesn't seem to scroll to the top:

shouldUpdateScroll={true};

Any idea?

@simonguo
Copy link
Member

simonguo commented Sep 6, 2022

hi @lomse The following example shows how scrollTop should be used.
https://rsuite.github.io/rsuite-table/
https://github.com/rsuite/rsuite-table/blob/main/docs/md/Virtualized.md
image

You trigger scrollTop(0) every time you click on the pagination, you can go back to the top of the table. About shouldUpdateScroll is to reset the scroll bar position after the size of the table changes, or the number of rows of data in the table changes.

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

No branches or pull requests

2 participants