Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YII2: How to add ICON in the gridview header

How to add an icon beside the header of a GRIDVIEW?

something like this.

[
   'attribute' => 'address',
   'format'=>'raw',
   'label'=>'<i class=\"fa fa-map\"><\i>test',
],
like image 554
beginner Avatar asked Oct 19 '25 14:10

beginner


1 Answers

You should set 'encodeLabel' property of DataColumn to false

        [
            'attribute' => 'address',
            'label' => '<span class="glyphicon glyphicon-star">' ,
            'encodeLabel' => false,
        ],
like image 60
ck_arjun Avatar answered Oct 22 '25 04:10

ck_arjun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!