Doesn't seem to work with AJAX enabled views

Created on 7 August 2023, over 1 year ago
Updated 20 June 2024, 5 months ago

Problem/Motivation

Love the module, does a great job.

We have a need to use AJAX with our view to enhance user experience when interacting with facets and exposed filters.

Steps to reproduce

We're using the module with a Views block display that has been embedded into a node's output.

An exposed filter form is providing full text input.

Taxonomy terms are being exposed as faceted options.

When the sort options (provided by this module) are used after a facet has been set, the URL in the address bar is changed to

/views/ajax?q=/view_path%3Fsort%3Dsort_field&order=desc&f%5B0%5D=facet-type%3A7214

The view_path sort_field and facet-type are replaced tokens; providing generic example placeholders

Proposed resolution

Assuming that the form needs to be able to provide an AJAX request when the base view that's being acted upon has AJAX enabled.

Would be great to get clarity on this from the module maintainer.

πŸ› Bug report
Status

Active

Version

1.1

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom lukus

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

Comments & Activities

  • Issue created by @lukus
  • πŸ‡ΊπŸ‡ΈUnited States justin.green

    We are having a similar issue. We are using this in an AJAX search view in combination with Views AJAX History. When AJAX is disabled, everything works well, but when AJAX is enabled, all of our search criteria (search string and facets) are removed when a sort is executed.

    To reproduce

    1. Install facets, search_api, search_api_sorts and views_ajax_history
    2. Configure a facet
    3. Enable AJAX history on the view that uses facets
    4. Configure Search API Sorts
    5. On the search view page, search a string and select a facet (results should update and URL string updated appropriately)
    6. Perform a Search API Sorts sort (all search and facet parameters are cleared out)

    Just for testing, I have taken Views AJAX History out of the equation. In that case, the facets are still cleared out. It would be great if the sort could be appended to the end of an AJAX search query URL.

    Thanks!

  • πŸ‡΅πŸ‡ΉPortugal joao.ramos.costa

    Hi @justin.green
    Faced the same issue,

    We have a custom block extending the search_api_sorts block as we needed a custom solution, but for the case the problem is the same.

    So as a workaround we're rendering the block in the view (there are several ways ie views_block_area ,etc.) then it is rebuilt on the ajax request.

Production build 0.71.5 2024