Soph
Soph

Reputation: 2915

Multiple level ordering in Yii

This is my CActiveDataProvider

$dataProvider = new CActiveDataProvider ('MyTable', array ( 
            'pagination' => array ( 
                    'PageSize' => 4, 
                ),
            'criteria' => array ( 
                    'condition' => 'from_user_id='.$user->id,
                    'order' => 'date DESC', 
                ), 
            ));

My question is: I would like to have this CActiveDataProvider ordered first by date (as the posted code does), and in a second level, within those with the same date, order by a second criteria. Is this possible?

Upvotes: 4

Views: 4051

Answers (1)

Eirik Hoem
Eirik Hoem

Reputation: 1310

Maybe I'm not understanding you correctly, but won't the following work? :

'order' => 'date DESC, name DESC',

Upvotes: 8

Related Questions