In Yii 1.1 this code works for default sorting:
$dataProvider = new CActiveDataProvider('article',array(     'sort'=>array(         'defaultOrder'=>'id DESC',     ), ));   How default sorting can be set in Yii2?
Tried below code, but no result:
$dataProvider = new ActiveDataProvider([     'query' => $query,     'sort' => ['defaultOrder'=>'topic_order asc'] ]); 
                I think there's proper solution. Configure the yii\data\Sort object:
 $dataProvider = new ActiveDataProvider([      'query' => $query,      'sort'=> ['defaultOrder' => ['topic_order' => SORT_ASC]],  ]);   Official doc link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With