Kurounin / Pagination

This package allows you to paginate the subscriptions over meteor's collections. It can be used in a Blaze template or in ReactJS.
MIT License
56 stars 22 forks source link

QUESTION: Does this package support infinite scrolling? #87

Closed carlosalvidrez closed 6 years ago

carlosalvidrez commented 6 years ago

Does this package support infinite scrolling? Thanks!

Kurounin commented 6 years ago

There's no out of the box support, but it can be implemented. To do it, do not add in the template the defaultBootstrapPaginator and add an onScroll event to check when you're near the end of the page to increase pagesize: Template.instance().pagination.perPage(Template.instance().pagination.perPage() + 10);

carlosalvidrez commented 6 years ago

Got it to work thanks. Further question... my template resizes every time the page count gets incremented, taking the user back to the top of the page. Do you know if I am doing something wrong, or a way to avoid this... I'd like the user to stay in the last "div"/document loaded, and just let the page grow down.

Thanks again.

Kurounin commented 6 years ago

Are you by chance showing a loading when the pagination is not ready? That would force the browser to resize the template height and when the documents are loaded it would have the scroll on top of the page. There's also the option to save the scroll position when changing the perPage and restoring it after they were loaded, but that will definitely be noticed as a scroll jump. Try to debug and check if the template is rendered with a lower height which would reset the scroll just before loading new documents.

carlosalvidrez commented 6 years ago

Thanks for the guidance. Haven't solved it yet, but I'll share a solution when I find it.

Cheers