Is it possible to convert GridView from table format to div in the index so I can customize the look of my index; my View is
<?php Pjax::begin(); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'Useravatar',
'format' => 'html',
'label' => 'Avatar',
'value' => function ($data) {
return Html::img('http://localhost:8585/yii45/wfp/web/' . $data['Useravatar'],
['width' => '80px', 'height' => '80px']);
},
],
'User_id',
'Usermode',
'Username',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
<?php Pjax::end(); ?>
if It's possible to make it something like, not exactly but somthing that use div and column
<?php Pjax::begin(); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
]); ?>
<div>
<div class="row">
<div class="col-md-3 text-center"> Username </div>
<div class="col-md-6"> Usermode </div>
<div class="col-md-3 text-right"> Useravatar </div>
</div>
<div class="row">
<div class="col-md-12"> Info </div>
</div>
<div class="row">
<div class="col-md-6"> edit </div>
<div class="col-md-6"> delete </div>
</div>
</div>
<?php Pjax::end(); ?>
I found this code about ListView :
https://www.yiiframework.com/doc/guide/2.0/en/output-data-widgets#list-view
use yii\widgets\ListView;
use yii\data\ActiveDataProvider;
$dataProvider = new ActiveDataProvider([
'query' => Post::find(),
'pagination' => [
'pageSize' => 20,
],
]);
echo ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => '_post',
]);
But I don't know where I have to add this code