Some of views ajax not working on stable theme.

Created on 7 June 2019, about 6 years ago
Updated 17 August 2023, about 2 years 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 2 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.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Since there has not been a follow up going to close out for now.

    If still a bug please reopen.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    I can still reproduce the issue with the Glossary view. Its letter navigation is non-ajaxified. Let's wait until someone can confirm this, before reopening. https://www.drupal.org/project/drupal/issues/2877958 πŸ› Glossary View: Ajax doesn't work Closed: duplicate

  • Status changed to Needs work about 2 months ago
  • πŸ‡§πŸ‡·Brazil igorgoncalves

    Thanks @anybody, i think we can reopen though.

    I just struggle with this issue on my project today.

    I will leave steps to reproduce:

    1 - clean install Drupal 11.2.2
    2 - contrib module: views_load_more 2.x-dev
    3 - create 2 or 3 test articles.
    4 - create a page view with pagination of 1 article by page, and using the load_more link.
    5 - check the view working with olivero, claro... any theme.
    6 - now drush generate a test theme with base theme: stable9
    7 - check views pagination stop work.

    After copy the views-view.html.twig file from olivero theme into my test theme folder. the views is back to work

    I tried to only add the classes as yivanov suggested at #6 but didnt work.

Production build 0.71.5 2024