How to output data to GRIDVIEW data from a linked table.
Model
public function rules()
{
return [
[['serial_nomer', 'nomer_fstek', 'nomer_skzi','naimenovanie'], 'string'],
[['seti', 'podrazdelenie', 'platforma'], 'integer'],
[['seti'], 'exist', 'skipOnError' => true, 'targetClass' => Seti::class, 'targetAttribute' => ['seti' => 'id']],
[['platforma'], 'exist', 'skipOnError' => true, 'targetClass' => Platforma::class, 'targetAttribute' => ['platforma' => 'id']],
[['podrazdelenie'], 'exist', 'skipOnError' => true, 'targetClass' => Podrazdelenie::class, 'targetAttribute' => ['podrazdelenie' => 'id']],
];
}
Table
<?= GridView::widget([
'dataProvider' => $dataProvider, -
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'naimenovanie:ntext',
'seti',
'serial_nomer',
'nomer_fstek',
'nomer_skzi',
'podrazdelenie',
'adres',
'platforma',
[
'class' => ActionColumn::className(),
'urlCreator' => function ($action, Vipnet $model, $key, $index, $column) {
return Url::toRoute([$action, 'id' => $model->id]);
}
],
],
]); ?>
I want to output “adres” from the “podrazdelenie” table to the main table.