I was working with views block and exposed filter set for it. The default value is set and displays all well for first time page load.
The view also works fine if the default value is changed, the output loads with ajax request properly. However, after this change if we go to some other page in the site and come back to the page having this view block with exposed filter, it displays the last selected value of exposed filter instead of default value. But the output display is of the default value.

Let me know if any further details are required.
Please help me in resolving this issue.


page display.png5.74 KBp657
Members fund testing for the Drupal project. Drupal Association Learn more


p657 created an issue.

saurabh.dhariwal’s picture

In expose filter settings, check "Remember the last selection " and check all roles there. This will solve the problem and will show results for last selected item.

p657’s picture

Sorry, but even "Remember the last selection" did not work. Finally what i did was:
1. Created a page view for the display with default value set.
2. Using panels placed it in the page.
3. Changed the exposed filter action from custom module to redirect it on the same page rather than the view page.
4. Disabled auto submit of the exposed filter and hide the apply button using CSS.
5. Wrote a custom JavaScript to submit the exposed form on change of dropdown select value.
This solution appends the selected value to the URL and thus even if we return back to the cached page, the value in the exposed filter remains same matching the data of the view output.

I know this is not the appropriate solution but it definitely solves the issue for time being.

shaunmilo’s picture

I feel like this needs more work in core. Using the "Remember the last selection" option doesn't work 100% of the time, and it seems to only remember the first instance of the selection when navigating back to the filtered view, even though you previously changed the selection to something else.

Doing something similar to what p657 said in #3 is probably the only viable method for now. It's just annoying to have to have a separate page (path) for each filtered option.