我已经设置并且过滤工作正常但在排序列时遇到问题 当我为id列设置排序时,它工作正常,但是当我设置其他列排序时,它不起作用
$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],
];
请告诉我这段代码有什么问题 提前致谢
答案 0 :(得分:0)
我发现问题实际上是因为我在$ query变量中使用了orderBy
orderBy(['challan.id'=>SORT_DESC])