I have this
GridView widget in my
<?= GridView::widget([ 'dataProvider' => $dataProvider, //'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], //'user_id', 'fname', 'lname', 'username', // 'password', // 'user_type', // 'creator', ], ]); ?>
It obviously generates a table containing data from my database table. I want to get rid of the
GridView widget and use other means of displaying data from the database. How do I do that?
One of the reasons why I don't want to use the
GridView widget is that I want the display to not look like a table. Something like this, for example:
Is there any way? Thanks.
Use ListView widget for these purposes.
Example of basic usage:
<?= ListView::widget([ 'dataProvider' => $dataProvider, 'itemView' => '_view', ]) ?>
_view view file you should place layout for a single user. Inside you can access the current user model through
$model variable and get desired attributes values. Read more in official docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!Donate Us With