Skip to content

feat(paginator): allow page size selection to be disabled #8373

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

Merged
merged 1 commit into from
Jan 23, 2018

Conversation

crisbeto
Copy link
Member

Adds an input that allows the consumer to disable the page size selection entirely.

Fixes #8359.

Note: the AoT compilation error is coming from master and will be fixed in another PR.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 11, 2017
@@ -96,6 +96,9 @@ export class MatPaginator implements OnInit, OnDestroy {
}
private _pageSizeOptions: number[] = [];

/** Whether to show the page size selection UI to the user. */
@Input() pageSizeEnabled = true;
Copy link
Member Author

@crisbeto crisbeto Nov 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewseguin I was torn between doing this and having some logic where the select is hidden if you pass in an empty array of options. I went with this since it's a bit more obvious what is going on.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment an empty array will display a label (whereas if there are several elements, it will display a dropdown) so I think overwriting the current behaviour wouldn't have been a good idea.

@crisbeto btw, thanks for the fast response to the issue.

@andrewseguin
Copy link
Contributor

Sorta conflicted on this one - seems like an easy CSS display: none for the user if they don't want it part of the UI, but it is nice when there's an API to make it feel more supported and less of a hack.

How do you feel about renaming as showPageSize? Or hidePageSize and default to false?

@crisbeto crisbeto force-pushed the 8359/paginator-enabled branch from 7eef0c6 to 2904ced Compare November 16, 2017 20:47
@crisbeto
Copy link
Member Author

crisbeto commented Nov 16, 2017

Renamed to hidePageSize @andrewseguin, can you take another look?

@andrewseguin andrewseguin added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Nov 21, 2017
@tinayuangao
Copy link
Contributor

@crisbeto Could you please fix the tests? Thanks

@crisbeto crisbeto force-pushed the 8359/paginator-enabled branch from 2904ced to 1e062f3 Compare November 28, 2017 20:07
@crisbeto
Copy link
Member Author

I think those failures were coming in from master @tinayuangao. I've rebased it against the current master.

@crisbeto crisbeto added the target: minor This PR is targeted for the next minor release label Dec 6, 2017
@andrewseguin
Copy link
Contributor

Can you verify that the tests are actually passing?

Adds an input that allows the consumer to disable the page size selection entirely.

Fixes angular#8359.
@crisbeto crisbeto force-pushed the 8359/paginator-enabled branch from 1e062f3 to d5937c9 Compare December 14, 2017 18:45
@crisbeto
Copy link
Member Author

Sorted out the paginator failures, there are still some failures from master, but they're unrelated.

@jelbourn jelbourn merged commit c8743e7 into angular:master Jan 23, 2018
@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 Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Paginator doesn't have an option to hide the pageSize value.
6 participants