简体   繁体   中英

How to retrieve the page number we are currently on, while using an antd table

I have created a table with the Antd in Reactjs. I have used 50 rows per page and I have around 6 pages that come up in the pagination. I have added an index column to the table, which loops from 1 to 50 on every page. Rather I need it to loop from 1 to full length. So when I navigate to page 2, It must show 51 to 100, whereas in my case it loops from 1 to 50 again. I made use of "index",that is passed from the "render" function in the table.

function indexRenderer(text, record, index) {
    return index+1
}

Is there any seperate function I can use to retrieve the page count alone from the pagination of antd.

You can use onChange function of Pagination component.

It will be called with page parameter.

Check this out for more information:

https://ant.design/components/pagination/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM