Make antd pagination dynamic

Asked

Viewed 50 times

0

Good, good day. I’m working with paging using the Antd Table component, this table does the data display, I’m trying to get when the user clicks on a certain number, the front will request the back to display the data.

I need to change the State of the table component in the pagination so that when the user clicks on a page number, he changes it dynamically and requests the back.

Code of my table:

<AntdTable
    dataSource={data}
    columns={columns}
    className={css.table}
    locale={{
      emptyText: <Empty image={image} description={description} />,
    }}
    rowKey={rowKey}
    pagination={{ current: 1, total: 50 }}
  />

Who can help me I will be very grateful !

  • Giovanni, how do you make the first request to the backend? I wonder why it is set on the property pagination Current: 1 and total: 50. These values could be some other variable possibly in the application state.

  • then, for testing I put as Current:1 and total:50, but the number of pages will be generated dynamically when the data coming from the API is loaded, i just wanted to know what logica to use to change the state of the Antd component so that when the user click on a number, it makes a request to the back

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.