YII2:如何在gridview中添加ICON header

YII2: How to add ICON in the gridview header

如何在 GRIDVIEW 的 header 旁边添加图标?

像这样。

[
   'attribute' => 'address',
   'format'=>'raw',
   'label'=>'<i class=\"fa fa-map\"><\i>test',
],

您应该将 DataColumn 的 'encodeLabel' 属性 设置为 false

        [
            'attribute' => 'address',
            'label' => '<span class="glyphicon glyphicon-star">' ,
            'encodeLabel' => false,
        ],