Page parameter remains on filter change

Created on 19 July 2024, 9 months ago

Problem/Motivation

With views ajax history enabled, the page parameter wrongly remains on filter change. This issue is a follow-up of a comment of @jasonawant in When views.ajax_path has a query string, query string is deformed :

After paginating to the second page of the result set, an exposed (search) filter submission includes the previous pagination query parameter. If the exposed (search) filter returns fewer results than the number of items per page, the view returns no results message b/c the view adds an off set b/c of the submitted pagination query parameter sent with the ajax request.

If views ajax history is not enabled, the page parameter is removed when changing the filter. The user jumps to the first page and gets the result with no offset.

When views.ajax_path has a query string, query string is deformed has been closed as duplicate of Faceted searches using views with exposed sorts are not retaining the facets on submit. , which should solve the issue. However, it only solves the problem if you have also activated facets.

Steps to reproduce

  • Activate ajax and ajax history
  • Set up pagination (only a few items per page to get multiple pages)
  • Display view and change page
  • Change filter without entire page reload
  • Note that the page has not been changed to the first one and you might get no results although there should be some

Proposed resolution

Remove the page parameter from views ajax history if filter have been changed.

🐛 Bug report
Status

Closed: duplicate

Version

1.7

Component

Code

Created by

🇩🇪Germany pminf Nuremburg (Germany), formerly Dresden

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @pminf
  • Status changed to Closed: duplicate 9 months ago
  • 🇩🇪Germany pminf Nuremburg (Germany), formerly Dresden

    This issue is not present in current 8.x-1.x-dev because it has been resolved with Exposed filters don't work correctly in Drupal 10.1 due to GET request being used instead of POST 📌 AJAX GET in core: Alter ajax url query parameters Needs review . Closing this as a duplicate. I hope there will be a new release soon.

Production build 0.71.5 2024