Why when I use filter in GridView flies value column?

In the column use the output of connected fields. If you use the search settings to go astray(that is, instead of a user Name, shows his id).
index.php in GridView
[
 'attribute' => 'user_id',
 'value' => 'user.name', 
 ],
July 4th 19 at 23:55
1 answer
July 4th 19 at 23:57
Solution
Good afternoon.
Perhaps it is necessary to call the function
[
 'attribute' => 'user_id',
 'value' => function($model){
 return $model->user->name;
}
]
How is it possible in the function to pass the values from another table (linked)? - modesta_Medhurst21 commented on July 5th 19 at 00:00
: I wrote it. In the model it is necessary to specify a relationship to another table.
For example:
public function getUser()
{
return $this->hasOne(User::className(), ['id' => 'user_id']);
}

https://github.com/yiisoft/yii2/blob/master/docs/g... - Dion77 commented on July 5th 19 at 00:03
: Understand) Thank you for the help! - modesta_Medhurst21 commented on July 5th 19 at 00:06

Find more questions by tags Yii