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.

Infinite scroll for Ant Table

See original GitHub issue

What problem does this feature solve?

As great as ant’s pagination is, it is also something that is not very modern. I’d like to wrap the table in a infinite scroll that would make ajax request and fetch more rows upon scrolling (Refer here). This is a simple example of creating such a table.

What does the proposed API look like?

To be honest, am not too sure at this point.

For a start we could wrap the Table in an InfiniteLoader HOC and have a event handler prop on the table onScroll that is triggered when the table is scrolled. The purpose of the InfiniteLoader would be to help break large data sets down into chunks that could be just-in-time loaded as they were scrolled into view.

I’ll be happy to send forth a PR if you think this might be useful. If not, please feel free to close this item.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:15
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

50reactions
buruburcommented, Aug 1, 2018

Wohoo, it is very easy to implement dynamic rows loading/infinite scrolling on antd table, I can chunk the httpRequest with this code:

componentDidMount() {
...
var tableContent = document.querySelector('.ant-table-body')
    tableContent.addEventListener('scroll', (event) => {
      // checking whether a selector is well defined
      console.log('yes, I am listening')
      let maxScroll = event.target.scrollHeight - event.target.clientHeight
      let currentScroll = event.target.scrollTop
      if (currentScroll === maxScroll) {
         // load more data
      }
    })
...
}
33reactions
benjycuicommented, May 3, 2017

I don’t think this feature should be included in antd. For it’s hard to decide that which element’s scroll events we should listen to.

And you can implement this in your own component easily.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Infinite scroll for Ant Table · Issue #22928 - GitHub
I have searched the issues of this repository and believe that this is not a duplicate. What problem does this feature solve?
Read more >
Ant Design Table with Infinite Scrolling - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >
antd-table-infinity - npm
An infinite scroll component based on antd table that supports virtual scrolling & high-performance form http://keruyun.com/.
Read more >
Infinite Scroll Table- Ant Design Demo - CodePen
Infinite Scroll Table - Ant Design Demo · Jose Manuel Benavides
Read more >
Ant Design Table Scroll Event - Stack Overflow
Didn't manage to find such feature in antd table, I used lazy pagination instead of infinite scrolling to work with big data. –...
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