Views with Ajax pagers don't filter correctly

Created on 6 July 2012, over 12 years ago
Updated 22 June 2023, over 1 year ago

One problem with this module (both Drupal 6 and Drupal 7 versions), is that the filter only works for the current page request.
If a view has a pager, then on page 2 the filter won't work. Often this might not be an issues, but for one use case I have it is:
The page have some nodes loaded at the top, below these, there is a view with views_exclude_previous-filter.
This view has a pager and uses ajax.
So when you click for the next page, sometimes you will get the nodes that are loaded at the top.

The problem is with the static variable that is used by the filter:

static $nids = array();

This variable only lives for the current page load and is cleared for any ajax-calls that are done later on the same page.
I don't know if anyone else is bothered by this, but I am and I have started testing alternative solutions.
On is to use cache_set and cache_get to save previously loaded/viewed nodes.
The problem is where this cache should be cleared.

If I comes up with something good, I share the code here.
And if anyone have some good ideas, I will love to get some input.

Thanks!

✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden overtune

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