How can I use ajax pagers with nested views_field_view fields?
I am using Drupal 9.2 and views_field_view to embed a "child" view within a "parent" view. Because there are multiple rows in the parent view, I end up with multiple of the same "child" view being rendered. This prevents the "pagination" from rendering because the "pager id" is the same for the multiple rendered child views.
I am able to circumvent that render issue by programmatically setting the pager id. See code below.
use Drupal\views\ViewExecutable;
function hook_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
if ($view->id() == '<view_id>') {
$unique_id = $view->args[0]; // argument that is a unique ID
$view->pager->options['id'] = $unique_id;
}
}
By using the above code in a module, the child view's pager now appears. However, clicking the pager numbers or buttons results in the parent view updating instead of the child view.
How can I change the pager for the "child" view so that it updates the child view instead of the parent? How can I use ajax pagers with nested views_field_view fields?
Active
1.0
Miscellaneous
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.