It is required to first define the relationships in the model, for example, you have models for the Category and Data tables, then the category model will have this method:
public function getData() { return $this->hasOne(Data::className(), ['id' => 'data_id']); }
Much detail here is chewed about Active Record.
Next, we can configure our own column directly in the GridView:
<?php echo GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ [ 'attribute' => 'id', 'value' => function ($model, $key, $index, $widget) { return $model->data->title; }, 'format' => 'raw', ], ], ]);
Maybe I missed something or didn’t quite correctly understand what you want to achieve, but I advise you to read the documentation on the githaba , where everything is pretty well chewed up. Successes in studying.
category.titlenot working? - Andrey KolomenskyhasOne:) Check that you can just makeecho $model->category->titlein theviewnext to theGridViewand in thecolumnstry to stuffcategory.title. - Andrey Kolomensky