This my grid view
echo GridView::widget([
'dataProvider' => $provider,
'columns' => [
'name',
]
]);
it will showing name of file with location , But i want to show if file is pdf ,pdf image will show , if file is doc doc image will show with download option, I can do code for downloading the file but i don't know how to show image and download link instead of text.
You can also try this way:
echo GridView::widget([
'dataProvider' => $provider,
'columns' => [
'name',
[
'attribute' => 'url',
'format' => 'raw',
'value' => function ($dataProvider) {
return Html::img($dataProvider->url, ['class' => 'img- rounded'], ['alt' => '']);
}
],
]
]);
Try this:
echo GridView::widget([
'dataProvider' => $provider,
'columns' => [
'name',
'imageColumn:image',
'urlColumn:url'
]
]);