Closed (fixed)
Project:
Views Show More
Version:
2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Mar 2020 at 13:23 UTC
Updated:
20 Jul 2023 at 12:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
drupal.ninja03 commentedI 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.
Comment #3
abhuman commentedI 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.
Comment #4
fizzgig commentedI'm seeing this same problem in D9.
Comment #5
jefflogan commentedI'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).
Comment #6
dipayanpramanik5 commentedDoes anyone resolves this issue. I am facing the same issue in d9
Comment #7
jeeba commentedI 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.
Comment #8
joe huggansSeeing 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.
Comment #11
ramprassad commentedFixed 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.
Comment #12
jim22 commentedThanks, 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.
Comment #13
ivnishThe patch #12 works
Comment #14
ivnishComment #16
ivnish