-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Pagination: should support disabled
prop
#3275
Comments
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
Recently I also needed to disable pagination and the solution I came up with was to explicitly set the // Disable all pagination items on page change.
const paginationProps: PaginationProps = {
totalPages: totalPages,
activePage: activePage,
onPageChange: this.handlePageChange,
// Each item is based on the default props, in case they may change in the future.
// defaultProps is not contained in the @types definition, hence the cast to any.
pageItem: {
...(Pagination as any).defaultProps.pageItem,
disabled: pageChanging,
},
nextItem: {
...(Pagination as any).defaultProps.nextItem,
disabled: pageChanging || (activePage >= totalPages),
icon: true,
content: <Icon name="angle right" />,
},
lastItem: {
...(Pagination as any).defaultProps.lastItem,
disabled: pageChanging || (activePage === totalPages),
icon: true,
content: <Icon name="angle double right" />,
},
prevItem: {
...(Pagination as any).defaultProps.prevItem,
disabled: pageChanging || (activePage <= 1),
icon: true,
content: <Icon name="angle left" />,
},
firstItem: {
...(Pagination as any).defaultProps.firstItem,
disabled: pageChanging || (activePage === 1),
icon: true,
content: <Icon name="angle double left" />,
},
ellipsisItem: {
icon: true,
content: <Icon name="ellipsis horizontal" />,
},
}; To just quickly disable all items though I'm also in favour of having a convenient |
disabled
prop
A very nice feature 👍 We definitely should implement it. |
I think a
disabled
option forPagination
would be very helpful.Sorry but the request is very simple. No more words :)
The text was updated successfully, but these errors were encountered: