Needs work
Project:
Views Hacks
Version:
6.x-1.x-dev
Component:
Views Filters Reset
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Oct 2010 at 19:10 UTC
Updated:
1 Aug 2011 at 22:28 UTC
Jump to comment: Most recent file
Comments
Comment #1
crea commentedSubscribing
Comment #2
infojunkieCan you confirm that this only happens with Ajax turned on?
Also, I don't understand what you mean by:
Comment #3
les limIt's not an AJAX issue; the module doesn't account for remembered filter values.
If a filter has been set to "Remember" its last used setting, Views will store the value of the filter input in the user's session each time the filters are applied. The next time that View is called, if a remembering filter isn't represented in the GET parameters, the filter value from the session is used instead. So simply setting window.location to the View URL without any GET parameters won't work, because the view will apply the values stored in the session.
The reset button should probably be turned into a proper FAPI 'submit' type so that it can fire a callback clearing the remembered filter information from the session. If I have time in the next few days, I'll look into it and post a patch.
Comment #4
les limAfter thinking about this a little more, we don't even need an additional submit callback. We can just check if the reset button is pushed and destroy the inputs in $form_state right in the form_alter, and we don't have to worry about the session values at all. At least, this seems to work for me. Patch attached.
Comment #5
infojunkieThanks for the patch. Seems to be working as far as I can tell too. However, it has an undesired side-effect:
Turn Ajax on in your view: you'll find two throbbers active when you click Apply or Reset. That's because the Views Ajax handler attaches to all 'submit' button in the form, and that's why I hadn't made the Reset button a regular 'submit'.
Comment #6
les limHuh, that's odd. I'm not very familiar with the AJAX system within views, so I'm not sure what the best fix for that would be. I do think the Reset button should be a regular submit so that it can work when JS is disabled, though.
Comment #7
bartezz commentedsubscribing!
Agree it should work without JS. But the throbber sucks ;) Isn't this a theme issue?
Comment #8
geerlingguy commentedSubscribe.
Comment #9
hanno commentedsubscribe