From 4988a81a75ffa1aecec69586ca19be042a839bbb Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Wed, 22 Jul 2015 15:50:11 +0100 Subject: [PATCH] Issue #2024695 by olli, SpadXIII: The "Reset" button ignores the "Use AJAX" setting (always behaves in a non-AJAX way) --- core/modules/views/js/ajax_view.js | 15 ++++++++------- .../views/exposed_form/ExposedFormPluginBase.php | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/core/modules/views/js/ajax_view.js b/core/modules/views/js/ajax_view.js index 1b9f1189ce9a..edfba50c0b70 100644 --- a/core/modules/views/js/ajax_view.js +++ b/core/modules/views/js/ajax_view.js @@ -108,14 +108,15 @@ * @method */ Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () { - var button = $('input[type=submit], input[type=image]', this.$exposed_form); - button = button[0]; - - var self_settings = $.extend({}, this.element_settings, { - base: $(button).attr('id'), - element: button + var that = this; + this.exposedFormAjax = []; + $('input[type=submit], input[type=image]', this.$exposed_form).each(function (index) { + var self_settings = $.extend({}, that.element_settings, { + base: $(this).attr('id'), + element: this + }); + that.exposedFormAjax[index] = Drupal.ajax(self_settings); }); - this.exposedFormAjax = Drupal.ajax(self_settings); }; /** diff --git a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php index 11a3e2d710e1..d17f70c7828e 100644 --- a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php +++ b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php @@ -321,7 +321,7 @@ public function resetForm(&$form, FormStateInterface $form_state) { } // Set the form to allow redirect. - if (empty($this->view->live_preview)) { + if (empty($this->view->live_preview) && !\Drupal::request()->isXmlHttpRequest()) { $form_state->disableRedirect(FALSE); } else { -- GitLab