GridView actionColumn comes with default buttons of ‘view’, ‘update’ and ‘delete’. What’s the best way to add a ‘download’ button to an actionColumn? Would appreciate if details are provided. Thanks.
GridView actionColumn comes with default buttons of ‘view’, ‘update’ and ‘delete’. What’s the best way to add a ‘download’ button to an actionColumn? Would appreciate if details are provided. Thanks.
Something like this, modify ActionColumn in the gridview:
['class' => 'yii\grid\ActionColumn',
'template'=>'{view} {update} {delete} {download}',
'buttons'=>[
'download' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-download"></span>', $url, [
'title' => Yii::t('yii', 'Download'),
]);
}
],
]
This works very good. Thank you very much.