CButtonColumn and Font Awesome icons

9 followers

This wiki article has not been tagged with a corresponding Yii version yet.
Help us improve the wiki by updating the version information.

I was looking for a way to use Font Awsome icons instead of the default images in a CGridView -> CButtonColumn. Perhaps this will be useful to someone.

Font Awsome Version 4.0.0

...
    array('class'=>'CButtonColumn',
        'template'=>'{update} {view} {delete}',
        'buttons'=>array (
            'update'=> array(
                'label' => '<i class="fa fa-edit"></i>',
                                'imageUrl' => false,
            ),
            'view'=>array(
                'label' => '<i class="fa fa-search"></i>',
                                'imageUrl' => false,
            ),
            'delete'=>array(
                'label' => '<i class="fa fa-trash-o"></i>',
                                'imageUrl' => false,
            ),
        ),
    ),

Total 3 comments

#14770 report it
VivekYii at 2013/09/09 01:25am
screenshot also

it is better if u add screenshot also

#14549 report it
trond at 2013/08/22 06:21am
Font awesome extension

For those who do not use Bootstrap, this could be a useful extension: fontawesome extension.

#14510 report it
JFReyes at 2013/08/19 07:02am
If you use Bootstrap there's already an icon option

Thanks for the tip for the regular CButtonColumn. Nevertheless, if you use TbButtonColumn and have FontAwesome enabled, you can specify 'icon'=>'icon-edit', etc.

Leave a comment

Please to leave your comment.

Write new article