ListView in Yii2
A list view is used to display the data from the dataprovider. Dataprovider can be ActiveDataProvider or ArrayDataProvider or SqlDataProvider.
In below example we are using ActiveDataProvider and _item_view for displaying by itemView property of ListView widget
use yii\widgets\ListView;
use yii\data\ActiveDataProvider;
$provider = new ActiveDataProvider([
'query' => User::find(),
'pagination' => [
'pageSize' => 30,
],
'defaultOrder' => [
'id' => SORT_ASC
]
]);
echo ListView::widget([
'dataProvider' => $provider,
'itemView' => '_item_view',
]);
ReplyDeleteIt is nice post and I found some interesting information on this blog, keep it up. Thanks for sharing. Outsource PHP Application Development in India