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

Fixing the issue #1111 #1116

Open
wants to merge 2 commits into
base: v2
Choose a base branch
from

Conversation

crypticbeing
Copy link

@crypticbeing crypticbeing commented Apr 23, 2024

In this updated example, I'm using the tableContainerRef variable that you've already declared and initialized in your original code. The rest of the logic remains the same:

  1. I've created a currentMaxPages state variable and initialize it with 4.
  2. I passed currentMaxPages as the maxPages option to the useInfiniteQuery hook.
  3. I've defined a handleScroll callback function that checks if the user has reached the bottom of the table, and if so, increases the currentMaxPages value by 2.
  4. I've added an event listener to the table container element (tableContainerRef.current) to listen for scroll events and call the handleScroll function.
  5. When currentMaxPages changes, the useInfiniteQuery hook will automatically refetch the data with the new maxPages value.

Please note that this solution assumes that you have the tableContainerRef and rowVirtualizerInstanceRef variables already declared and initialized in your original code.

Copy link

vercel bot commented Apr 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
material-react-table ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2024 8:24am
material-react-table-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2024 8:24am

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.

1 participant