...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

Reference: https://www.drupal.org/core/beta-changes
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)
CommentFileSizeAuthor
#6 interdiff.txt650 bytesolli
#6 2024695-6.patch1.62 KBolli
#3 2024695-3.patch1.62 KBolli
#1 2024695-1.patch1.49 KBspadxiii

Comments

spadxiii’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.49 KB

I 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. :)

jhedstrom’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll, +Needs manual testing, +VDC

Patch no longer applies.

olli’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll +JavaScript
StatusFileSize
new1.62 KB

Reroll.

prashantgoel’s picture

This patch looks good to me. It solves the issue described.

jhedstrom’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

I'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.

olli’s picture

StatusFileSize
new1.62 KB
new650 bytes

Fixed eslint error

core/modules/views/js/ajax_view.js
  113:80  error  Missing space before function parentheses  space-before-function-paren
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 4988a81 and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation to issue summary.

  • alexpott committed 4988a81 on 8.0.x
    Issue #2024695 by olli, SpadXIII: The "Reset" button ignores the "Use...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jagermonster’s picture

The 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) {