Quantcast
Viewing all articles
Browse latest Browse all 293672

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

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.

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.

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.

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

Hope this helps!


Viewing all articles
Browse latest Browse all 293672

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>