My Yii CGridView Sorting is not working this way when
public function search() {
$criteria = new CDbCriteria;
$criteria->order = "member_id DESC";
When I click header menu in CGridView
it is not working but when I remove
$criteria->order = "member_id DESC";`
sorting is working fine. I want to show records by default order by member_id desc
.
Remove this line $criteria->order = "member_id DESC";
Amend your return:
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
'sort' => array(
'defaultOrder' => 'member_id DESC',
),
));
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