Filters are applied after pagination in list of tables within database
#16,084 opened on Apr 16, 2020
Repository metrics
- Stars
- (6,886 stars)
- PR merge metrics
- (Avg merge 2d 17h) (11 merged PRs in 30d)
Description
Describe the bug
See steps to reproduce
To Reproduce
Steps to reproduce the behavior:
- Go to https://demo.phpmyadmin.net/master-config/
- Click on a database that has at least 250 tables
So now you are in the Structure tab of the database you picked, and you are seeing the list of tables in this database. Because they are more than a lot, you see the first N in page 1.
- In the "Filters" input box next to "Containing the word:" enter a substring that you know is found in the names of several tables that are not all within the current page
For exampe, let's say you have tables named "table1", "table2", ... through "table400". You are at page 1, so you are seeing tables "table1" through "table125" or something.
Type "12" which means matching tables are "table12", "table112", "table120", ..., "table212", ... and several others
Expected behavior
The filter should be applied BEFORE pagination. So, ALL tables from the whole database that match with the filter should be selected and displayed, and THEN pagination should be applied if the matching tables are more than can fit in a page.
So in our example you should see all the tables mentioned above.
Observed behavior
(btw, the section "Observed behavior" is missing from the bug template)
The filter is applied AFTER pagination. So, you'll see only a subset of the first N tables that would fit within page 1 with no filter, and among those, those that match the filter.
So in our example you will only see "table12", "table112", "table120" through "table129" (I might be forgetting some) but not "table212", "table312" etc.
A filter working this way is completely useless. If it is by design, it's a wrong design. There's no question about that. Filter and then pagination is useful, pagination and then filter is useless. I hope don't need to explain that (if I need to explain that, there's no hope that you are able to fix that). Every widget I have ever seen that has pagination and filters works as I described in expected behavior, that is first filters and then pagination. Because it's the only useful and sensible way.
This, added to the fact (which is another separate bug) that there is no "show all" option for tables, makes it IMPOSSIBLE to have a list of all the tables that match a given filter without going page by page and repeating the search.
If there was a "show all" option, then that would mitigate the issue. Basically the filters would be useless within a single page but you could go to "show all" and then apply the filter.
Server configuration
whatever the demo has
Client configuration
- Browser: irrelevant, but Chrome
- Operating system: irrelevant but Ubuntu