Ajax Facets blocks for views

Created on 10 November 2016, over 7 years ago
Updated 29 June 2023, about 1 year ago

I have an interesting issue that I am trying to solve. Basically I need a page where users can search via textbox, and have select boxes to filter results on taxonomy terms.

I am using search_api_solr and built a view (as a page) based on my index. In my view, I created an exposed filter on the full text search. Also, I've created 2 facets, both on taxonomy term names. I've added the blocks to the page and everything looks good. When I search, the page refreshes and the facets are updated correctly.

The problem Im having is that I need the view to use AJAX so the results get updated without a page reload. I set the view to use ajax and saved it. Then when I go to my search page and enter in a search term, the search results get updated, but the facet blocks stay the same.

I tried to embed the facet blocks directly into view header, but they disappear when I enter a search term.

How can I get the facet blocks to work in views with AJAX enabled?

✨ Feature request
Status

Fixed

Version

1.0

Component

Search API integration

Created by

πŸ‡¨πŸ‡¦Canada sagesolutions

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 dbroll

    @voleger

    Is there any way how to keep view display use ajax but disable it for the facet block?

    I was able to accomplish this for my use case (needed views infinite scroll to have ajax but not facet blocks). By disabling the related js file from the facet module in my active theme's info.yml file:

    libraries-override:
      facets/drupal.facets.views-ajax: false
    
Production build 0.69.0 2024