O
O
Oversec2016-09-16 09:17:27
Yii
Oversec, 2016-09-16 09:17:27

Why does the value of the column flies when using a filter in a GridView?

In a column I use an output of connected fields. When using the search, the settings are lost (that is, instead of the Username, it shows its id).

index.php в GridView
[
                'attribute' => 'user_id',
                'value' => 'user.name', 
 ],

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-09-16
@Oversec

Good afternoon.
You may need to call a function

[
  'attribute' => 'user_id',
  'value' => function($model){
        return $model->user->name;
  }
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question