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

[EuiBasicTable] shows no items if all items of last page is deleted #3422

Closed
ashikmeerankutty opened this issue May 5, 2020 · 7 comments · Fixed by #3431
Closed

[EuiBasicTable] shows no items if all items of last page is deleted #3422

ashikmeerankutty opened this issue May 5, 2020 · 7 comments · Fixed by #3431
Labels

Comments

@ashikmeerankutty
Copy link
Contributor

In EuiBasicTable if all items on the last page are deleted. The table shows no Items found.

Screen Cast 2020-05-05 at 2 35 38 PM

@anishagg17
Copy link
Contributor

What should be the desired behavior, should the user be redirected to the previous page or the first page?

@chandlerprall
Copy link
Contributor

That's a good question. @thompsongl what are your thoughts? On one hand, basic table could detect an out-of-bounds page and call onChange to move it to the last one; on the other, the app itself owns paginated and we could say it's up to it (and the example) to ensure correct pagination data.

@thompsongl
Copy link
Contributor

At the very least, it appears to be an error that the pagination bar becomes hidden in this scenario. I think we could go just a bit further and detect the out-of-bounds page and move to the actual last page.

@chandlerprall
Copy link
Contributor

go just a bit further and detect the out-of-bounds page and move to the actual last page

Via the callback (make the application update and fix the problem), or just ignore the invalid input at that point and clamp to the valid page range? (< 0 becomes 0, > MAX becomes MAX)

@thompsongl
Copy link
Contributor

Clamp to the valid page range. Seems like pagination_bar could detect when pageIndex > pageCount (which is not part of parent state) and use the onChangePage callback to set parent state to next-to-last page

@chandlerprall
Copy link
Contributor

Thanks!

which is not part of parent state

Good observation

@ashikmeerankutty does that make sense?

@ashikmeerankutty
Copy link
Contributor Author

@chandlerprall I think I got it. I will make a PR for the same. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants