Primeng: Turbotable with paginator does not respect the maximum number of rows per page and duplicates the data.

Created on 21 Feb 2018  路  4Comments  路  Source: primefaces/primeng

I'm submitting a ... (check one with "x")

[x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)

http://plnkr.co/edit/4xBgXOKSZTGsufhqDPMq?p=preview

Take a look at any page between 1 and 10. We have rows per page = 5.

Current behavior

Turbotable with paginator does not respect the number of rows per page. The first page is correct, the last one is correct too, but any page between those two indexes is wrong. It displays n*i row, where n is the number of rows allowed and i the index of the page (with i < index of last page). It also duplicates the data.

Expected behavior

Turbotable with paginator should only display the correct number of rows and not duplicate the data.

Angular version
5.2.0

PrimeNG version
5.2.0

Browser
All

Most helpful comment

This same behavior is noticed if you try and set the .rows property outside of the definition.

@ViewChild('dt2') dt2: Table;

this.dt2.rows = rpp;

Any chance of making the component reflect this type of change throughout. I need to be able to change the rowsPerPage from oustide the embedded paginator. I thought this was working, but when I added more rows/pages, I noticed the behavior described above. First and last pages look good, but everywhere inbetween is displaying all records.

All 4 comments

Hi ,
I think you have this issue because you use " rows=5 " instead of " [rows]=5 " in your template.
Please try with : " "

It indeed was the issue. I took the code from https://www.primefaces.org/primeng/#/table/crud (or https://github.com/primefaces/primeng/blob/master/src/app/showcase/components/table/tablepagedemo.html), I guess it is more of a documentation issue. Feel dumb for not seeing that I used the template directive instead of the property. Thanks!

My mistake of forgetting the [], docs fixed now at master.

This same behavior is noticed if you try and set the .rows property outside of the definition.

@ViewChild('dt2') dt2: Table;

this.dt2.rows = rpp;

Any chance of making the component reflect this type of change throughout. I need to be able to change the rowsPerPage from oustide the embedded paginator. I thought this was working, but when I added more rows/pages, I noticed the behavior described above. First and last pages look good, but everywhere inbetween is displaying all records.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

papiroca-tm picture papiroca-tm  路  3Comments

jisqaqov picture jisqaqov  路  3Comments

lilling picture lilling  路  3Comments

Helayxa picture Helayxa  路  3Comments

philly-vanilly picture philly-vanilly  路  3Comments