0

I am getting data partially from backend (let's say 10 rows per api call) and I want to call the api on page change but I am unable to find any relevant option in react-bootstrap-table pagination. Is there any solution to this problem?

0

2 Answers 2

1

"react-bootstrap-table2-paginator" takes a prop of onPageChange where you can do what you want with the page number https://codesandbox.io/s/react-bootstrap-table-paging-example-forked-rqhyd5

  <BootstrapTable
        bootstrap4
        keyField="id"
        data={products}
        columns={columns}
        pagination={paginationFactory({ sizePerPage: 5, onPageChange:(page)=>console.log("DB CALL with page" + page) })}
      
      />
Sign up to request clarification or add additional context in comments.

1 Comment

ps: Check the console on codesandbox link
0

if you dont want to see pagination selectbox , you can add sizePerPageList property in paginationFactory settings,

form example;

 <BootstrapTable
    bootstrap4
    keyField="id"
    data={products}
    columns={columns}
    pagination={paginationFactory({
      sizePerPageList: [
        {
          text: "5",
          value: 5
        }
      ],
      onPageChange: (page) => console.log("DB CALL with page" + page)
    })}
  />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.