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

When list is displaying a non-existent page, it's really hard to understand what's happening #6090

Closed
VincentLanglet opened this issue May 11, 2020 · 2 comments · Fixed by #6500
Assignees

Comments

@VincentLanglet
Copy link
Member

Environment

Subject

Let's say your admin has only 8 pages.
If you modify the page parameter in the query and look for the page 10 you'll get:
image

This situation can also happen with persisted filter, if the list is modified by someone else when I'm on it (I'm on the last page and someone remove the last lines) or I log out/log in with another user and refresh the list.

It's really hard to understand that I'm on page 10, and that I see nothing because there is only 10 pages. Plus, I can't go to a valid page easily. I need to reset the filter, which is not obvious for users.

There should be a better UX, for example the list of available pages should be still there (but if only one page exists that's not enough since we don't display the page choice). Another solution could be to display something like "The page xx reports no result ; Try with page 1".

@core23
Copy link
Member

core23 commented May 11, 2020

Technically speaking, this is not a bug. It's a common problem when you use a pager and try to access a page that does not exist.

There are different solutions to solve this UX problem e.g. move to the last / first page or show a warning message.

@VincentLanglet VincentLanglet self-assigned this May 17, 2020
@VincentLanglet
Copy link
Member Author

There is still something weird in the way the Pager works.

  • The Datagrid call buildPager.
  • In this method, there are the following call $this->pager->setPage($page); to set the page, then $this->pager->setQuery($this->query); to set the query and finally $this->pager->init();.
  • In the init method, we set the lastPage $this->setLastPage(max(1, $t));.
  • This method is doing
if ($this->getPage() > $page) {
    $this->setPage($page);
}

So if i have only 3 pages, and I try to access the fourth one, the query is looking for the fourth one, but then I tell my Pager I'm page 3. IMHO we should let the Pager page 4, it would be then easier in the twig to give a better UX if page > lastPage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment