Is there a way to reset the current page?
See original GitHub issueAdding this issue because it was asked to me directly.
If you’re filtering items, and the data needs to be completely changed, the page needs to be reset back to pageStart
.
One solution is adding a method to the component: https://github.com/guillaumervls/react-infinite-scroll/pull/29
But really, if you need your own pagination methods, you should handle it in the state of your own component and ignore the pageToLoad
parameter that you’re given.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:22 (5 by maintainers)
Top Results From Across the Web
How to reset the Pagination's current page when pageSize ...
The logic here is, since onShowSizeChange triggers first, will set the locla variable setSize to true and set the page num to 1....
Read more >Make Google your homepage - Google Search Help
Reset your homepage. Choose a browser above, then follow the steps to replace Google with the site you want as your homepage. Check...
Read more ><input type="reset"> - HTML: HyperText Markup Language
Try entering some text into the text field, and then pressing the reset button. Adding a reset keyboard shortcut. To add a keyboard...
Read more >JavaScript reset - Javatpoint
In HTML, we can use the reset button to reset the form. In this article, we are discussing how to reset the form...
Read more >How to completely reset the Google Chrome browser to its ...
Scroll down once more to the bottom of the page. You'll find the “Reset and clean up” section. Click on “Restore settings to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@LorisTujiba found a work around that worked for me. Basically, add
key
property to any element that wrap the react-infinite-scroller and update thatkey
to a different value, and this will cause the whole element to be recreated.More details: https://stackoverflow.com/a/21750576/439427
I’ve just added the ref to the InfiniteScroll:
<InfiniteScroll ref={(scroll) => { this.scroll = scroll; }} />
And reset the current page when i needed it:
this.scroll.pageLoaded = 0
Working for me. I am not sure but maybe all is needed just to add reset function to component from the PR above https://github.com/guillaumervls/react-infinite-scroll/pull/29/files#diff-daf041c271b89525b1dde05048d6383dR44I can create PR but i don’t know is it the best solution or not.