Skip to main content

Filter Grid view en Model Search

In Search Model for filter

add public property
public $locatie;
add to safe in rules
 public function rules() {
    return [
        ....
        [['locatie'], 'safe'],
    ];
}
add in join
// locatie is attribute from student
$query = Gesprek::find()
            ->joinwith(['student'])

note that student is relation

public function getStudent()
{
   return $this->hasOne(Student::className(), ['id' => 'studentid']);
}
add in andFilterWhere

 

In Search Model for sort

add sort attributes

 

In view

add column