...as per title.
STR:
1. Edit a view with exposed filters (for example the "People" or the "Content" view).
2. Go to Advanced -> Other -> Use AJAX and set it to "yes".
3. Visit the view page and filter something: results load via AJAX.
4. Filter another time: results still load via AJAX.
5. Hit the "Reset" button: page refresh!
Beta phase evaluation
| Issue category | Bug because views doesn't properly use AJAX for the reset button |
|---|---|
| Issue priority | Not critical |
| Prioritized changes | The main goal of this issue is usability (in that the 'use ajax' button will be applied properly to the reset button) |
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | interdiff.txt | 650 bytes | olli |
| #6 | 2024695-6.patch | 1.62 KB | olli |
| #3 | 2024695-3.patch | 1.62 KB | olli |
Comments
Comment #1
spadxiii commentedI just ran into this issue myself and found a solution:
First part of the problem is that in the ajax_views.js `attachExposedFormAjax` only the first button gets ajax-ed. I changed this so that all buttons are ajax-ed.
Second part is that upon reset, the form redirects. This means you get a '303 See Other'-response, because in the `resetForm` method of `ExposedFormPluginBase` it's only checking if this is a live-preview. Here it should also check if it's a xmlHttpRequest (ajax) and keep the form_state-redirecting disabled if it is.
I think this also needs tests, but I don't have an idea how to create a test for this. :)
Comment #2
jhedstromPatch no longer applies.
Comment #3
olli commentedReroll.
Comment #4
prashantgoel commentedThis patch looks good to me. It solves the issue described.
Comment #5
jhedstromI've manually tested without the patch, and with the patch, and can confirm the bug, and that the patch resolves the issue.
I've added a beta phase evaluation to the summary.
Comment #6
olli commentedFixed eslint error
Comment #7
alexpottCommitted 4988a81 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to issue summary.
Comment #10
jagermonster commentedThe reset button still does not seem to function correctly when the view is rendered in a modal and has ajax enabled
It looks like this was not merged correctly and is conflicting with https://www.drupal.org/comment/reply/2732111
This patch https://www.drupal.org/files/issues/2732111-30.patch removes the bind from the reset button
$('input[type=submit], input[type=image]', this.$exposed_form).not('[data-drupal-selector=edit-reset]').each(function (index) {I think this line should be changed to the following:
$('input[type=submit], input[type=image]', this.$exposed_form).each(function (index) {