Problem/Motivation

Ajax does not work with views exposed filters when this theme is enabled.

Steps to reproduce

Add exposed filter to view.
Enable Ajax on view.

Comments

iamfredrik created an issue. See original summary.

iamfredrik’s picture

Here is a workaround copied from the Barrio theme.

in sub_theme.info.yml add the following:

libraries-extend:
  views/views.ajax:
    - sub_theme/views.ajax

in sub_theme.libraries.yml add the following:

views.ajax:
  js:
    src/js/modules/views/ajax_view.js: {}

in your sub_theme create a file src/js/modules/views/ajax_view.js with the following:

/**
 * @file
 * Extends core ajax_view.js.
 */

(function ($, Drupal) {
  'use strict';
  /**
   * @method
   */
  Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () {
    var that = this;
    this.exposedFormAjax = [];
    $('button[type=submit], input[type=submit], input[type=image]', this.$exposed_form).not('[data-drupal-selector=edit-reset]').each(function (index) {
      var self_settings = $.extend({}, that.element_settings, {
       base: $(this).attr('id'),
        element: this
      });
      that.exposedFormAjax[index] = Drupal.ajax(self_settings);
    });
  };

})(jQuery, Drupal);
hosisam’s picture

Status: Active » Closed (cannot reproduce)

I just tested it and seems to works just fine.
Closing this as I can't reproduce. Feel free to reopen the issue if it still persits.