Problem/Motivation
Currently if we search something and a No records available page is shown, we have unnecessary pagination links.
Also if data is limited to single page, (1) is shown as pagination.
Steps to reproduce
Remove pagination if no data is available to display or data is limited to single page.
Proposed resolution
Remaining tasks
- ✅ File an issue about this project
- ☐ Manual Testing
- ☐ Code Review
- ☐ Accessibility Review
- ☐ Automated tests needed/written?
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | after2.png | 68.93 KB | libbna |
| #13 | after1.png | 53.78 KB | libbna |
| #13 | beforee.png | 64.59 KB | libbna |
Issue fork project_browser-3295320
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
omkar-pd commentedPagination is not displayed at the bottom of the page if there is no data available.
Comment #5
tim.plunkettThanks for opening this issue! Good find.
I think the check for 0 should occur in Pagination.svelte itself.
I'm not sure if there's a way to have logic like this
or if the whole nav element has to be wrapped in
But either way, it will keep all of the logic in the same file, and will also mean if we ever reuse Pagination we won't have to worry about copying the count check.
Comment #6
omkar-pd commentedas per #5 added logic in
pagination.svelte.Comment #7
vighneshh commentedi will review this
Comment #8
vighneshh commentedApplied MR It works fine.
Adding Before and After screenshots also.
Moving it to RTBC.
Comment #9
vighneshh commentedComment #10
narendrarSetting it to NW, as there is one more scenario which was missed in issue. There is no need for pagination (1) if data is limited to single page.
Comment #11
narendrarComment #12
omkar-pd commentedAdded check for page count.
Comment #13
libbna commentedReviewed last MR and it LGTM. But because tests failed marking it as Needs Work.
Comment #14
tim.plunkettIf we do want to hide the pager for a single page of results, we'll need this one change. But I'm not 100% sure we do want that. I'll leave it to Chris or Ben to decide.
Comment #15
saschaeggiI vote to remove it as it has no use and can be confusing
Comment #16
omkar-pd commentedShould we change check from
{#if count > 0 && pageCount > 0}to{#if pageCount > 0}.I think
{#if pageCount > 0}will also hide the pagination if no data available as well as if there is only one page.Comment #17
narendrarAgree with #16 as
countcorresponds to number of items andpageCountis number of pages starting from 0.Comment #18
omkar-pd commentedChanged
{#if count > 0 && pageCount > 0}to{#if pageCount > 0}..Comment #19
tim.plunkettGreat teamwork, thanks @narendraR for the suggestion about hiding the pager even further.