Page 1 of 1

PrimeReact DataTable alternative server-side pagination

Posted: 26 May 2021, 20:52
by fabio.costa
Hi there! I have this very large data to fetch in my app and for that i have an API that provides me the number of pages i`ll get deppending on the number of rows i whant to show per page. So i can fetch only de first page, for example, and then make new requests on each page number i click!

I`m aware of the Lazyloading provided by this component but my problem is to fetch all the data, store it at state and then, filter it before render.

Is there a way to make the datatable paginator shows the number of pages links my API returns?

Thank you vary much, best regards!

Fábio

Re: PrimeReact DataTable alternative server-side pagination

Posted: 07 Jun 2021, 15:42
by fabio.costa
Well, i`ve done it myself with one "workaround" that might be usefull for others too:
Since my API returns how many pages exists deppendind on rows number per page sent to request, using the Lazy attribute of DataTable i`ve calculated the totalRecords by multiplying rows sent and pages number returned.

I uderstand that the "rows" and "totalRecords" attributes at "Lazy" mode can return the number os page links that paginator needs to deal with total records to show. My totalRecords does not allways returns the exact total records number but since its only goal is to return paginator page links, it works perfectly!