Hi , I m using GridView::widget(
‘dataProvider’ => $dataProvider,
'layout' => "{items}{summary}{pager}",
'options' => ['class' => 'grid-view table-responsive'],
'tableOptions' => ['class' => 'table table-bordered table-striped table-hover'],
'columns' => [
[
'class' => 'yii\grid\SerialColumn',
],
// Data columns
[
'class' => 'yii\grid\DataColumn',
'attribute' => "person_id",
'content' => function ($model) {
if (!empty($model->person->id)) {
return $model->person->id;
}
},
],
]
I want to make sort by person id, can anyone tell me how to do that ?