-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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] Add functionality to jump to first and last page #9278
Comments
Hi @andrewseguin I'd be keen to give this one a go |
Sounds good to me, let's set the requirements and iterate from there:
|
I agree with the above requirements. For tests would it just be the spec tests? I don't see the paginator in the e2e tests. |
Yup just some spec unit tests would suffice, try to consider the main case and edge cases, e.g. the jump-to-first button should be disabled when on the first page |
Whilst doing the above I found two bugs in the spec file. Would it be best to do them as separate PRs or in the same PR that I'm currently working on, when I have completed this feature?
The bug fix for 2 is required in order to write a valid test for the current feature. |
Good catch - if you submit the fixes via separate PRs, that'd be a lot easier for us. |
Thanks! And will do |
Do I need to create issues for them or straight to the PRs? |
No issue needed, just a PR will do |
Will do. On a side note: for the Component attribute of showing/hiding the first and last buttons would you have any recommendations on naming? I am thinking e.g. <mat-paginator [pageIndex]="pageIndex"
[pageSize]="pageSize"
[pageSizeOptions]="pageSizeOptions"
[hidePageSize]="hidePageSize"
[hideFirstLastButtons]="hideFirstLastButtons"
[length]="length"
(page)="latestPageEvent = $event">
</mat-paginator> |
Naming tends to be one of the harder parts of these sort of features. By default, the paginator shouldn't show the first/last buttons anyways since the material spec doesn't include them. I imagine the flag would be more like Curious how the interaction would look if you had a paginator for an "infinitely" long list. You'd want to make sure you can easily hide the Jump to Last button since it doesn't make sense. |
Ok, I'll make the first/last buttons hidden by default and implement the Shall I add |
Since its a pretty uncommon case and I'd lean more towards keeping a thinner API surface, let's leave those off. In that case it should be fairly trivial to just add a If it comes up from users in the future, we can always add it in then |
Great point |
the test was referencing the wrong page discovered in angular#9278
Is there a best practice for doing multiple PRs for the same file to avoid the conflicts on merge? |
Whilst there are 10 pages they are starting from index 0 and therefore the last page is in fact index 9. This error was repeated both in the length calculation and in the assertion statements, therefore the test passed when it should have failed. Discovered in angular#9278
I have added the first and last buttons to the demo app, in a new table, and to the material-examples, to the existing table, is this correct or would there be a better way to do this. Additionally, would we need to submit a PR to the material.angular.io docs? Here's where I'm currently at:
I'll have a look into the icons tomorrow but the functionality and all the tests are done 😄 |
Fix such that the previous page navigation button contains an icon with decrement, and the next page navigation button contains an icon with increment. Previously they were swapped around. Noticed during fix for angular#9278
Fix such that the previous page navigation button contains an icon with class decrement, and the next page navigation button contains an icon with class increment. Previously they were incorrectly swapped. Noticed during fix for angular#9278
Fix such that the previous page navigation button contains an icon with class decrement, and the next page navigation button contains an icon with class increment. Previously they were incorrectly swapped. Noticed during fix for angular#9278
Add two buttons which allow you to jump to the first and last page. Hidden by default and can be toggled with showHideFirstButtons Fixes #angular#9278
Ah right - go ahead and include the fixes in your PR and then write in the description that they include fixes from the other PRs and that the PR is blocked until the others are in. Since they are small I imagine they will be merged fairly quickly. Once they are in, you can rebase and remove the disclaimer on your final PR |
Add two buttons which allow you to jump to the first and last page. Hidden by default and can be toggled with showHideFirstButtons Fixes angular#9278
Whilst there are 10 pages they are starting from index 0 and therefore the last page is in fact index 9. This error was repeated both in the length calculation and in the assertion statements, therefore the test passed when it should have failed. Discovered in angular#9278
Thanks Andrew, will do! |
This is awesome. Great work @lharries! |
Whilst there are 10 pages they are starting from index 0 and therefore the last page is in fact index 9. This error was repeated both in the length calculation and in the assertion statements, therefore the test passed when it should have failed. Discovered in #9278
the test was referencing the wrong page discovered in #9278
Add two buttons which allow you to jump to the first and last page. Hidden by default and can be toggled with showHideFirstButtons Fixes angular#9278
Add two buttons which allow you to jump to the first and last page. Hidden by default and can be toggled with showHideFirstButtons Fixes angular#9278
Add two buttons which allow you to jump to the first and last page. Hidden by default and can be toggled with showHideFirstButtons Fixes angular#9278
) Add two buttons which allow you to jump to the first and last page. Hidden by default and can be toggled with showHideFirstButtons Fixes #9278
Fix such that the previous page navigation button contains an icon with class decrement, and the next page navigation button contains an icon with class increment. Previously they were incorrectly swapped. Noticed during fix for angular#9278
Fix such that the previous page navigation button contains an icon with class decrement, and the next page navigation button contains an icon with class increment. Previously they were incorrectly swapped. Noticed during fix for angular#9278
Fix such that the previous page navigation button contains an icon with class decrement, and the next page navigation button contains an icon with class increment. Previously they were incorrectly swapped. Noticed during fix for angular#9278
Fix such that the previous page navigation button contains an icon with class decrement, and the next page navigation button contains an icon with class increment. Previously they were incorrectly swapped. Noticed during fix for angular#9278
@lharries I'm seeing this in Edge on first render: Once you click on the button it corrects: Any ideas? |
@btroncone apologies for that. I'll set up an Edge development environment and get this fixed |
@lharries No worries! Had QA catch it in one of my projects and wanted to make you aware. I messed around with it briefly but didn't reach a solution I was happy with, hopefully you will have better luck! |
@btroncone I'll create an issue and see if we can get it fixed |
@btroncone there's a fix already submitted #9776 |
@lharries Awesome, thanks for the update! |
Hi how to install this package @lharries ? is it by the default npm install --save @angular/material? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Feature request
What is the expected behavior?
There should be 2 buttons like << and >> to jump to the first and last page.
What is the current behavior?
There is no button for this. There is only a button for < and > prev and next.
Items per page: 10 - 1 - 10 of 100 < >
What is the use-case or motivation for changing an existing behavior?
If you have a long list, often it is needed to jump to the end and back to the first page/first items.
Items per page: 10 - 1 - 10 of 100 << < > >>
Is there anything else we should know?
#7615 - as a reference.
The text was updated successfully, but these errors were encountered: