Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
- Create a paged view with an exposed filter.
- Go to the last page (page n).
- Search for a keyword that will yield results, but not enough to display n pages.
- Behold a pager for the exact number of pages available after the search query, but you're still on page n, which is empty.
Proposed resolution
Do not enforce the page number when submitting an exposed filter form.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#1 | views_ajax_history_2427343_1.patch | 472 bytes | Xano |
Comments
Comment #1
XanoI'm no JS guru, so it may not be the prettiest code. We basically found out that this is where the Views AJAX request GET parameters are passed through, so we find the right parameter and reset the page number.
Comment #2
joelpittetThanks @Xano. It should use a comment so future people can sort out what you are doing here but that code looks good in my books, changes the first argument's page object if it exists to 0.
Comment #3
gunwald CreditAttribution: gunwald commentedWorks for me, thank you! Is this module still maintained?
Comment #4
joelpittetMinimally:D
Comment #6
joelpittetI've committed this as a new co-maintainer. It's still minimally maintained but now with more help;)
Comment #8
Floris Vedder CreditAttribution: Floris Vedder commented@Xano, works for me
My exposed filters got stuck due to this in combination with views_load_more. Thanx for the fix