question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scrollableTarget not working

See original GitHub issue

Hi, i was having trouble while using infinite scrolling, because data was being loaded when my browsers main window scrollbar scrolled. So i tried using scrollableTarget to fix the problem, but when i tried using it the loader keeps displaying and no data is fetched. Code looks like this:

<Container id="divID">
        <InfiniteScroll
          dataLength={this.state.logs.length}
          next={this.fetchMoreData}
          hasMore={true}
          loader={<Loader />}
          scrollableTarget="divID"
        >
          <Table striped>
            <thead>
              <tr>
                <th>...</th>
                <th>...</th>
                <th>...</th>
              </tr>
            </thead>
            <tbody>
              {this.state.logs.map(event => (
                <tr key={event.id}>
                  <td>....</td>
                  <td>....</td>
                  <td>....</td>
                </tr>
                    ))}
            </tbody>
          </Table>
        </InfiniteScroll>
</Container>

Here you can see the id of Container screen shot 2018-05-28 at 00 25 05

I Also tried using scrollableTarget=document.getElementById("divID") and it now renders the content but it only loads more data when the main window scrollbar moves not when the one in my Table element does.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
lsvargascommented, May 30, 2018

@ankeetmaini sorry if i didnt make myself clear, I want next to be called when my Table’s scrollbar reaches the end, but what is actually happening in the code above is that next is called when the main window scroll moves.

0reactions
aakin03commented, Jul 27, 2021

Hi, I know this issue has been closed, but are we still able to get a response? I’m having a similar issue as many of those previously. I’ve set up InfinteScroll to wrap around a Table. InfinteScroll & Table are located inside of a TableContainer component. The TableContainer has an id which I used as the scrollableTarget in InfinteScroll. In my main page, my table scrolls as expected with more data loading when I pass the threshold. However, when I try to use my table in a Dialog, InfinteScroll no longer works. When I scroll, I’m not reaching my next function. How can InfinteScroll work while on a main window, but not when in a Dialog?

Read more comments on GitHub >

github_iconTop Results From Across the Web

React InfiniteScroll in a scrollable component on the page
I am trying to build an infinite scroll in a div with a fixed height and a scroll attached to it, so my...
Read more >
react-infinite-scroll-component v6.1.0
infinite scroll with scrollableTarget (a parent element which is scrollable) ... Note that the scroll event is throttled, so you may not receive...
Read more >
react-infinite-scroll-component
If your scrollable content is being rendered within a parent element that is already providing overflow scrollbars, you can set the scrollableTarget prop...
Read more >
React infinite scroll scrollableTarget get id dynamically?-rx.js
[Solved]-React infinite scroll scrollableTarget get id dynamically?-rx.js. Search. score:1. the problem is solved like this scrollableTarget={item.id.
Read more >
react-infinite-scroll-component
Start using react-infinite-scroll-component in your project by running `npm i react-infinite-scroll-component`. There are 350 other projects ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found