What data must be sended to dataprovider?
In my controller:
public function actionIndex() {
$searchModel = new UserSearch();
$dataProvider = $searchModel->search( Yii::$app->request->queryParams );
//other stuff and sending array of params to view
in a view:
echo ListView::widget( [
'dataProvider' => $dataProvider,
] );
but i got only id`s:
And if i`m set single view like:
'itemView' => '_single',
how send data to _single.php ?
I mean - need default template for view list items like in GridView:
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'username',
'email:email',
'password',
'role',
//....
And then i got perfect grid:
Controller - SiteController.php
View (1) - index.php
View (2) - _item.php
Example Result :
in official docs http://www.yiiframework.com/doc-2.0/yii-widgets-listview.html#$itemView-detail
So your User model data should be available in _single.php as $model->username
how send data to _single.php ?
Here is how, use$viewParams
So i suppose can use Detail View in _single.php i think: