How to implement paging with API in reactjs with datatable

29 views Asked by At

Fist we have load react datatable with empty data after that will call api you get data based on filter and need to display all data so if change page size to all with empty data then it will give error. Warning: Received NaN for the children attribute. If this is expected, cast the value to a string.

Paging also display with NAN page numbers.

Is there any way to display all data with api and react datatable.

Thanks

We want to filter pages size to all with empty data.

1

There are 1 answers

0
manimk On

I think you missed page size and total count, That's why you Received NaN Because pagination total count is NaN, You have to set 0 for total count and while calling API use loading.

Request table data before set loading once data length greater than 0 stop loading after show table.

you may refer here https://mui.com/material-ui/react-pagination/