Eui: [EuiBasicTable] shows no items if all items of last page is deleted

Created on 5 May 2020  路  7Comments  路  Source: elastic/eui

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

engineer bug

Most helpful comment

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

All 7 comments

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

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.

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.

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)

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

Thanks!

which is _not_ part of parent state

Good observation

@ashikmeerankutty does that make sense?

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

Was this page helpful?
0 / 5 - 0 ratings