I have all set and filtering is working fine but facing problem in sorting columns When I set sort for id column it works fine but when I set other columns sort, it is not working
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 50,
],
]);
$dataProvider->sort->attributes['id'] = [
'asc' => ['challan.id' => SORT_ASC],
'desc' => ['challan.id' => SORT_DESC],
];
$dataProvider->sort->attributes['studentname'] = [
'asc' => ['student.studentName' => SORT_ASC],
'desc' => ['student.studentName' => SORT_DESC],
];
$dataProvider->sort->attributes['sid'] = [
'asc' => ['challan.sid' => SORT_ASC],
'desc' => ['challan.sid' => SORT_DESC],
];
Please tell me what is wrong with this code Thanks in advance
I have found the problem actually it is because I have used orderBy in $query variable