Widget and formatter broken if view uses AJAX

Created on 19 March 2024, 8 months ago
Updated 2 April 2024, 8 months ago

Problem/Motivation

The widget is not shown in views (needed template).
If the widget is used in views and the view is using AJAX for sorting, pagination or filtering, the widget and the formatter are shown only on the first page after load. If the view is sorted, the widget/formatter are lost - the bootstrap_toggle librrary is not reattached to the form and only a checkbox is shown.

Steps to reproduce

1. Create a view with table style plugin based on an entity, which has checkbox field using bootstrap toggle as a for widget.
2. Enable AJAX for the view.
3. Add some fields and the checkbox to the view
4. Ensure the checkbox field is showing the bootstrap toggle widget
5. Sort the view by clicking the column header or use the pager
6. The widget is gone and only a checkbox is shown

Proposed resolution

Reattach the library to the form using Drupal.behaviors and a custom JavaScript

Remaining tasks

Provide a patch

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

🇦🇹Austria jordik

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

Comments & Activities

Production build 0.71.5 2024