Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paginator issues with the data length #17628

Closed
buster95 opened this issue Nov 6, 2019 · 4 comments
Closed

Paginator issues with the data length #17628

buster95 opened this issue Nov 6, 2019 · 4 comments

Comments

@buster95
Copy link

buster95 commented Nov 6, 2019

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/fork/components-issue

https://stackblitz.com/angular/lrnjnmrrmlp?file=src%2Fapp%2Fpaginator-configurable-example.ts

Steps to reproduce:

  1. go to last page
  2. then change the data length
    A blank page appears, since the length of the current data is not filling up to the current page, you must press the button on the previous page many times

Expected Behavior

What behavior were you expecting to see?
I want that the paginator current page change to 1 because if the data change you dont know if the current data length could be filling the current page

Actual Behavior

What behavior did you actually see?
current page is in empty

Environment

  • Angular: 8.2.4
  • CDK/Material: 8.1.4
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 1902
@ccjmne
Copy link
Contributor

ccjmne commented Nov 6, 2019

I don't think this should be the Paginator's responsibility.

What if I build a UI that lets users remove an item from the collection in a single click? They wouldn't want to be brought back to the first page.

I think it's reasonable that it is up to you to call paginator.firstPage() when your data model is updated, if you desire so.

@andrewseguin
Copy link
Contributor

We intentionally designed the MatPaginator to simply display what it is told, rather than automatically deciding what to do when the page is out of range of the length. Unfortunately there is no one-size-fits-all solution to automatically selecting a page in this case

@buster95
Copy link
Author

buster95 commented Nov 6, 2019

I don't think this should be the Paginator's responsibility.

What if I build a UI that lets users remove an item from the collection in a single click? They wouldn't want to be brought back to the first page.

I think it's reasonable that it is up to you to call paginator.firstPage() when your data model is updated, if you desire so.

I try to do that but not work, I don't know why, How can I get paginator variable?? can you help me please

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants