primeng icon indicating copy to clipboard operation
primeng copied to clipboard

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

Open ghost opened this issue 8 years ago • 4 comments

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

ghost avatar Feb 21 '18 10:02 ghost

Hi , I think you have this issue because you use " rows=5 " instead of " [rows]=5 " in your template. Please try with : " <p-table [value]="data" [paginator]="true" [rows]="5"> "

mricciuti avatar Feb 21 '18 11:02 mricciuti

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!

ghost avatar Feb 21 '18 11:02 ghost

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

cagataycivici avatar Mar 04 '18 10:03 cagataycivici

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.

steve-kuennen avatar Apr 13 '18 14:04 steve-kuennen