In my case, I configured my view to be as below.

  • Initial items: 4
  • Items to display: 8
  • Offset (number of items to skip): 0

I have 29 items to show, on the 3rd page the show more button is hidden although there is one more item to show.

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

a.qala created an issue. See original summary.

drupal.ninja03’s picture

Status: Active » Closed (cannot reproduce)

I am unable to reproduce this bug. For me, the pager is working fine. I have total 11 items for my page view and the show more button appears correctly.

abhuman’s picture

Status: Closed (cannot reproduce) » Active

I am able to reproduce this on Drupal 8.9 with a similar setup to Ammar.

It is due to this change which removes the call to the pager plugin's getPagerTotal method that Views Show More overrides to implement the different initial and subsequent page sizes.

fizzgig’s picture

I'm seeing this same problem in D9.

jefflogan’s picture

I've just run into this issue, which seems to happen if the "Initial items" is less than the "Items to display".

In my case I had:
Initial items: 12
Items to display: 16

I had 15 items for the view to display, so there should have been 2 pages, ie initial page of 12 items and then 3 items.

To workaround the issue, if I changed the "Items to display" to 12, pagination worked again.

Looking a little further into the isuse, it seems to occur in the function views_show_more_preprocess_views_show_more_pager, as this does not take into account the initial limit, and uses the normal limit (which was set as 16 in my case).

dipayanpramanik5’s picture

Does anyone resolves this issue. I am facing the same issue in d9

jeeba’s picture

I got the same problem over here.I'm using the DEV version.

Fixed it on line 29 of views-show-more.module. The line says
if ($current < ($total - 1)) {

I make it

if ($current < ($total)) {

And it works.

joe huggans’s picture

Seeing this in Drupal 9 also, works fine if not using Ajax on your view.

The ajax command viewsShowMore seems to be running twice, the second time it runs $($.parseHTML(response.data, document, true)) is empty.

But then even if you force it to just run once, there is still the issue of it not showing the last page, which #7 fixes but not sure if this is the proper way to handle this.

This module is broken when using AJAX.

ramprassad made their first commit to this issue’s fork.

ramprassad’s picture

Fixed the issue in the Views Show more module and opened a merge request.

The issue is that when you click Show more initially you can see in the AJAX response there are 2 viewsshowmore callbacks - one with the data and the other with empty data which means viewsshowmore gets called twice. This happens when you use the normal pager which calls "insert" command.

The fix adds the if empty check for the newcontent in viewsshowmore AJAX Command similar to the core misc.js for the 'insert' AJAX Command.

jim22’s picture

Thanks, ramprassad! Your updates seem to be working for me. I created a patch from your fork so I could test it. Will attach it for anyone else that needs it.

ivnish’s picture

Status: Active » Reviewed & tested by the community

The patch #12 works

ivnish’s picture

Status: Reviewed & tested by the community » Fixed

  • ivnish committed 20b6f465 on 2.x authored by ramprassad
    Issue #3123495 by ramprassad, jim22, Ammar Qala, fizzgig, abhuman,...
ivnish’s picture

Version: 8.x-1.x-dev » 2.x-dev

Status: Fixed » Closed (fixed)

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