Some of views ajax not working on stable theme.

Created on 7 June 2019, almost 6 years ago
Updated 17 August 2023, over 1 year ago

I have problem with views_infinite_scroll on my custom sub-theme based on core's stable theme. Ajax for page didn't working, no event subscriber on button.

So I found this js code:

/core/modules/views/js/ajax_view.js

Drupal.views.ajaxView.prototype.filterNestedViewsPager = function (id, link) {
    return !this.$view.parents('.view').length ? $(link).parents('.view').length === 1 : true;
  };

  Drupal.views.ajaxView.prototype.attachPagerAjax = function () {
    this.$view.find('ul.js-pager__items > li > a, th.views-field a, .attachment .views-summary a').filter($.proxy(this.filterNestedViewsPager, this)).each($.proxy(this.attachPagerLinkAjax, this));
  };

If you see at filterNestedViewsPager function, you can found that this code expecting .view class on dom element, but there is no view class in html.

Here is a twig of view template of stable theme:
core/themes/stable/templates/views/views-view.html.twig

{%
  set classes = [
    dom_id ? 'js-view-dom-id-' ~ dom_id,
  ]
%}
<div{{ attributes.addClass(classes) }}>

Proposed solution:

a) Add class to html.twig, like classy theme does.
b) Add this class (or other class/attribute) on preproces

πŸ› Bug report
Status

Closed: outdated

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 8 hours ago

Created by

πŸ‡ΊπŸ‡¦Ukraine 5n00py

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024