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?
Command icon 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

narendraR created an issue. See original summary.

omkar-pd made their first commit to this issue’s fork.

omkar-pd’s picture

Status: Active » Needs review
StatusFileSize
new41 KB

Pagination is not displayed at the bottom of the page if there is no data available.

tim.plunkett’s picture

Status: Needs review » Needs work

Thanks 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

{#if count === 0}
  return
{/if}

or if the whole nav element has to be wrapped in

{#if count > 0 }
...
{/if}

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.

omkar-pd’s picture

Status: Needs work » Needs review

as per #5 added logic in pagination.svelte .

vighneshh’s picture

Assigned: Unassigned » vighneshh

i will review this

vighneshh’s picture

StatusFileSize
new46.8 KB
new50.26 KB

Applied MR It works fine.
Adding Before and After screenshots also.
Moving it to RTBC.

vighneshh’s picture

Assigned: vighneshh » Unassigned
Status: Needs review » Reviewed & tested by the community
narendrar’s picture

Status: Reviewed & tested by the community » Needs work

Setting 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.

narendrar’s picture

Title: Remove pagination links(Next > / Last >|) if no results are available to display » Remove pagination links if not required
Issue summary: View changes
omkar-pd’s picture

Status: Needs work » Needs review
StatusFileSize
new77.73 KB

Added check for page count.

libbna’s picture

Status: Needs review » Needs work
StatusFileSize
new64.59 KB
new53.78 KB
new68.93 KB

Reviewed last MR and it LGTM. But because tests failed marking it as Needs Work.

tim.plunkett’s picture

Status: Needs work » Reviewed & tested by the community

If 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.

saschaeggi’s picture

I vote to remove it as it has no use and can be confusing

omkar-pd’s picture

Should 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.

narendrar’s picture

Agree with #16 as count corresponds to number of items and pageCount is number of pages starting from 0.

omkar-pd’s picture

Changed {#if count > 0 && pageCount > 0} to {#if pageCount > 0}..

tim.plunkett’s picture

Status: Reviewed & tested by the community » Fixed

Great teamwork, thanks @narendraR for the suggestion about hiding the pager even further.

  • tim.plunkett committed 611e619 on 1.0.x authored by omkar-pd
    Issue #3295320 by omkar-pd, tim.plunkett, Vighneshh, narendraR: Remove...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.