AJAX pager doesn't work with exposed filter which has a default value

Created on 13 December 2019, almost 5 years ago
Updated 4 September 2023, about 1 year ago

Problem/Motivation

The original issue is here but for the Drupal7 Views module. Below is copy/paste from that issue. All credits to @uq

Currently when a view uses AJAX pager and exposed filter with a default value at the same time, the view is not providing an accurate result when navigating the page.

The issue here was within the javascript of views. If the parameter doesn't have a property or if it is null (in this case, the date value is null after you selected "-Year"), it removes the parameter in the request. If the parameter is removed, Views will set the filter to the default value.

Hope this helps!

Steps to reproduce

To reproduce the issue:
1) Create a content type with a date field
2) Create a number of nodes with above content type
3) Create a View using unformatted list and fields under Format
4) Add Content: [Your date field] under Filter Criteria
5) Select Year under Filter Granularity
6) Check the checkbox "Expose this filter to visitors, allow them to change it" in the Configure filter criterion popup
6) Select a year (e.g. 2014) under Operator
7) Click Apply (all displays)
8) Click Advanced > User AJAX and select Yes
9) Save the view and go to the view page
10) Select "-Year" in the exposed filter and click apply

At this point, you should see a list of nodes with that field and a pager underneath
11) Go to page 2 through the pager

The list of nodes are gone and the exposed filter is reset to the default value.

Proposed resolution

The patch allows empty property to be passed within the query string parameter.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

10.1

Component
Views 

Last updated about 22 hours ago

Created by

🇺🇦Ukraine nikita_tt

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024