Hello all,
in grid of my index page i want a DropDownList to filter data.
In my DropDownList i wanted to get the firstName and Surname to be returned as one string.
My code not work well. The activeDropDownList is empty. Why ?
This is my code:
public function getFullName()
{
return $this->first_name . ' ' . $this->first_name;
}
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'User',
'value' => 'id_user',
'filter' => Html::activeDropDownList($searchModel, 'id_user', ArrayHelper::map(\app\models\user::find()->asArray()->all(), 'id_user','fullName'),['class'=>'form-control','prompt' => '---- Seleziona ----']),
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>