Use widget in AJAX loaded view

Created on 10 October 2018, about 6 years ago
Updated 3 June 2023, over 1 year ago

I'm using a Fivestar widget in an embedded view that is loaded via ajax. Clicking on the stars results in a 404, as the ajax url is taken from the view ajax url. I've tried using exactly the same view in a normal page, and it works fine. For the working example, the request looks something like:

https://[domain]/drupal/tracks?ajax_form=1&wrapper_format=druapl_ajax

which works, as the item being voted for is a track, however, when the view is loaded via ajax, the request looks like:

https://[domain]/drupal/views/ajax?ajax_form=1&wrapper_format=drupal_ajax

because the view is loaded via the ajax endpoint. In each case, if I examine the request headers and payload, they seem to be the same, so everything else seems good, I believe (hope) I just need to find a way to override the url of the ajax request.

For reference, I used this guide to build the ajax loading functionality, if it helps:

https://www.thirdandgrove.com/rendering-view-ajax-drupal-8

Happy to create a custom formatter, that's what I've been looking at, but can't quite work out how the various parts combine, and therefore what I would need to add/change in order to make this work.

Any advice very welcome.

Paul

πŸ’¬ Support request
Status

Closed: duplicate

Component

Widgets

Created by

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