Open derah04 opened 9 years ago
On PoController.php
public function actionView($id)
{
$model = $this->findModel($id);
$modelsPoItem = $model->poItems;
$searchModel = new PoItemSearch();
$searchModel->po_id = $model->id;
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return Yii::$app->controller->render('view',[
'model' => $model,
'modelsPoItem' => $modelsPoItem,
'searchModel'=> $searchModel,
'dataProvider'=> $dataProvider,
]);
}
On view.php
use yii\helpers\Html;
use yii\widgets\DetailView;
use kartik\grid\GridView;
use yii\widgets\Pjax;
....
...
..
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'po_no',
'description:ntext',
],
]) ?>
<?php Pjax::begin(); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
//'filterModel' => $searchModel,
'columns' => [
// ['class' => 'yii\grid\SerialColumn'],
'po_item_no',
'quantity',
],
]); ?>
<?php
Pjax::end(); ?>
How to create actionView() ??