Pagination in PrimveVue Datatable not showing the correct page links

287 views Asked by At

I am using pagination (primevue.org/paginator) in primevue datatable as it:

<DataTable ref="dt" :value="dataItems" dataKey="id" :loading="loading1" :paginator="true" :totalRecords="50" :rows="5" :pageLinkSize="50" @page="handlePagination"> 

What its Doing

I have set totalRecords="50" and :rows="5" It shows no link to next/prev pages if server returns 5 data rows.

if server return 10 rows, then it is showing 2 page links in pagination bar and so on...

What it should do

There should be page links based on totalCount from server e.g :totalRecords="50"

For example, i If server return totalCount=50 then it should show 10 page links in pagination bar and 5 data rows on each page so If user click on page 2, 3, 4... the request should go to server to fetch the related page data.

Event Data on clicking the page link

{ "originalEvent": { "page": 1, "first": 4, "rows": 4, "pageCount": 2 }, "first": 4, "rows": 4, "sortField": null, "sortOrder": null, "multiSortMeta": [], "filters": {}, "pageCount": 2, "page": 1 }

What changes should I made to generate links according to totalRecords so I can send request to server to get other pages data as well.

Is it possible with https://primevue.org/paginator

0

There are 0 answers