Answer the question
In order to leave comments, you need to log in
How to access columns in Gridview in Yii2 ArrayDataProvider?
I display data through Gridview + ArrayDataProvider.
How can I access the string value?
'columns'=>[
[
'label'=>$title,
'attribute'=>'ubg',
'value'=>function($model){
},
]
],
Answer the question
In order to leave comments, you need to log in
what means does not work, you do not return anything from the method?
what does it mean to refer to columns? render fields?
then in columns you can simply list the names of the fields
columns=>[
'id',
'name',
'email'
]
'columns' => [
[
'label' => $title,
'attribute' => 'name',
'value' => function ($model) {
return $model['name'] . $model['surname'];
},
],
'age',
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question