angular / angular/components

[Paginator] When Updated length is "shorter" than the pageIndex (*pageSize), pageIndex should be updated and then a pageEvent to the pageIndex emited

Aperta
#14,520 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area: material/paginator P4
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### What is the expected behavior?
When I am on the last Page of a dataSet and then delete the elements that are currently showing (or filter elements "away"), and thereby change the length property, the paginator should update the pageIndex to the ACTUAL lastPage and then _emitPageEvent() there.

#### What is the current behavior?
When I am on the last Page of a table and then delete the element(s) that are currently showing, the paginator will simply show a empty table with a label like "91 - 100 of 90".
Also: I am using an Array as Datasource for my Table.

#### What are the steps to reproduce?
The example in the Documentations shows the behavior very well (but if necessary I can still provide the stackblitz with a table)
https://material.angular.io/components/paginator/examples

Steps
#1 Click 9x on the "nextPage" Button until you are on the last Page (91-100 of 100)
#2 Click on the input "List length" and enter "90"
-> The paginator shows "91-100 of 90" INSTEAD should show "81-90 of 90" and a PageEvent fired to the last Page

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
I had the problem with Material+Material 6, but apparently it shows as well on 7
Browser: Chrome
OS: Win 10

#### Is there anything else we should know?
Inside the Paginator Component: The setter function for the length property could simply test `if (Math.floor(value, this.pageSize) < this.pageIndex) { /* set pageIndex and emitPageEvent accordingly */}`

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con l'esempio di paginator nella documentazione di Angular Material, riproduci la modifica della lunghezza dell'ultima pagina da 100 a 90, quindi esamina il setter di length del componente Paginator. Il lavoro è completato quando la pagina passa da 91–100 a 81–90 di 90 e viene emesso un PageEvent per la nuova ultima pagina.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.