I’m working with a data column (yii\grid\DataColumn) for the gridview widget.
I want to configure the grid so that I can use an image as a label. Currently I can configure a column like so…
…
[
'attribute' => 'carspaces_garaged',
'header' => '<img src="/images/site/icons/car-sm-primary.gif">',
],
…
This appears ok, however, it doesn’t enable a sorting link. It just returns the raw image.
If I do it like this:
[
'attribute' => 'carspaces_garaged',
'label' => '<img src="/images/site/icons/car-sm-primary.gif">',
],
the sorting link works, but the label comes out as text and not html image. Does anyone know how I can configure an image and be able to use it as a clickable sorting link?