October CMS resources and help articles

Simple and to the point. Optimized by the community.

Bind injectRowClass to relation widgets lists

0
by xyz.qtc, last modified on July 23rd, 2024

This method, relationExtendViewWidget, enhances the visual presentation of relation widgets by binding the injectRowClass event to dynamically apply a CSS class to each row in the widget's list view. Specifically, the provided anonymous function returns the CSS class strike, which can be customized to suit different styling needs. This approach offers flexibility in styling rows based on specific conditions or criteria, thereby improving the user interface and experience of the relation widgets within the application.

public function relationExtendViewWidget($widget, $field, $model)
{
    $widget->bindEvent('list.injectRowClass', function ($record) {
        if ($record->someCondition) {
            return 'strike'; // Apply 'strike' css class if condition is met
        }
    });
}

Discussion

0 comments

We use cookies to measure the performance of this website. Do you want to accept these cookies?