- 🇮🇳India himanshu_jhaloya Indore
Hi I am looking patch for D9 is there any patch for this same issue version 2.0.1
- 🇩🇰Denmark erik_petra
Patch at #55 did not apply successfully for me through composer patches, so I fixed it and also fixed some formatting. Patch is for 2.0.1, due to Drupal 10 upgrades.
- 🇬🇧United Kingdom ChristianSanders
Unfortunately the latest patch (comment #56) isn't working as desired.
I have a view with 9 results.
Initially set to display 7 and load 6 thereafter.
The initial items of 7 display, but because my view results don't have enough results to reach an additional 6 (9 results, 7 of initial page load, therefore 2 more to load in) the pager doesn't load.
I've tested by changing initially show 4 items and then 3 thereafter on load. The pager displays, loads in my 3, then no more pager, cause I have 2 items left, not 3.
This is all tested via AJAX.
- last update
about 2 years ago Patch Failed to Apply - 🇬🇧United Kingdom ChristianSanders
Added a patch that solves my comment in 58.
- 🇬🇧United Kingdom ChristianSanders
Uploaded the files the wrong way around perviously - sorry!
- last update
about 2 years ago 2 pass - 🇩🇪Germany Anybody Porta Westfalica
Thanks @ChristianSanders could you prepare that as MR perhaps, please?
- Open on Drupal.org →Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8last update
about 2 years ago Not currently mergeable. - 🇬🇧United Kingdom ChristianSanders
@Anybody done - https://git.drupalcode.org/project/views_infinite_scroll/-/merge_request... (hope i've done this correctly - this is my first time contributing a patch via an MR!) Thanks :)
- Status changed to Needs work
about 2 years ago 11:12am 7 September 2023 - 🇩🇪Germany Anybody Porta Westfalica
Thanks @ChristianSanders. Looking quite good, but there is a conflict left. Perhaps it was based on an older branch? Could you resolve that one?
Here you can see the resulting diff from the MR: https://git.drupalcode.org/project/views_infinite_scroll/-/merge_request...
In the end it should be equal to your one? - last update
about 2 years ago 2 pass - 🇮🇳India himanshu_jhaloya Indore
I was facing the same issue but checked with views_infinite_scroll-2852080-2852080-different-item-count this branch it is working fine for me thanks @christiansanders
- 🇩🇪Germany Anybody Porta Westfalica
Thanks. So the last step here seems to be to add test coverage?
- 🇺🇦Ukraine rsych
I checked the patch from #61, and there is another bug. My steps:
1. I set 6 items to show on load
2. I set 3 items to add on each "load more" click (I use the button)
Result: when I have 3 items in total, no "load more" button is shown (correct). But after creating another node, I have this behavior: it shows 4 nodes and (here's the error itself) the "load more" button. After clicking on this button, it disappears (without adding any item because everything is already displayed). - 🇻🇳Vietnam ypx
This is an updated patch file to fix the bug reported at #68
The number of pages needs to be recalculated
When creating a pager we set total items = current_total_items + (items_per_page - initial_items). - First commit to issue fork.
- 🇺🇸United States damienmckenna NH, USA
I updated the merge request with the changes from #69 (and the latest changes from the 2.0.x branch).
In my local testing the new options work well, thank you all.
- 🇩🇪Germany Anybody Porta Westfalica
Thanks, still needs tests (FunctionalJavascript) as last step, right? Who's our hero? 🦸🦸♀️
- Status changed to Needs review
5 months ago 7:56am 14 April 2025 - First commit to issue fork.
- 🇳🇱Netherlands anneke_vde
I added a test for the different initial loading and after first page loading other amount.
- 🇮🇳India mugesh.s Tamil Nadu
mugesh.s → made their first commit to this issue’s fork.
- 🇮🇳India mugesh.s Tamil Nadu
Alternative Implementation
Hi all,
This approach provides another way to implement the feature without disturbing the current functionality.
Please review, test, and confirm if this works as expected.I’ve also added test coverage to validate the behavior.
Issue Summary
This proposal adds a new “Page Control” feature to the Views Infinite Scroll pager plugin, allowing site builders to specify different item counts for:
- The first page
- All subsequent pages
This is useful in UX scenarios where the first page of a listing (e.g., landing pages or featured sections) should show fewer or more items than the rest.
Proposed resolution
- ntroduce a checkbox
Enable Page Control
in the pager settings. - When enabled:
- Hide the existing
Items per page
field. - Show two new number fields:
Items for the first page
Items for the other pages
- Modify internal pagination logic to:
- Set per-page limits conditionally based on current page.
- Adjust offset and total count logic accordingly.
- Update
getRemainingItems()
andgetNumberItemsLeft()
methods to reflect accurate counts. - include
#states
logic in the options form for dynamic field visibility.
User interface changes
A new checkbox and two conditional number fields will be shown in the Views UI under the pager settings.
Example Use Case
For example, I want to display only 4 items on the homepage (page 0), but load 2 items on all other pages. This feature enables that flexibility without needing to override views programmatically.
Video Demonstration
Here’s a working demo of the feature implemented on my site:
→
→This feature has been implemented in the branch:
2852080-Add-Page-Control
A patch has also been attached here for testing.
✅ Please review and test the patch and merge request.
💬 Feedback and suggestions are most welcome!