CActiveDataProvider, sort defaultOrder with multiple columns

Hi, is it possible to add a secondary sorting column using defaultOrder in CActiveDataProvider?

In my model i currently have this:




return new ActiveDataProvider($this, array(

	'criteria' => $criteria,

	'sort' => array(

                'defaultOrder' => array(

      			'date' => true // Would be nice to add something like this here: 'date, id' => true

    		)

        ),

        'pagination' => array(

        	'pageSize' => 20

    	),

));



Thanks!

you can specify:




'sort' => array(

                'defaultOrder' => array(

                        'date' => true,

                        'id' => false

                )

        ),



or




'sort' => array(

                'defaultOrder' => 'date DESC, id ASC',

        ),



what U need is :

‘sort’ => array(

            'defaultOrder' => 'date DESC, id ASC',


    ),
1 Like

Thanks for the help, adding ‘id’ => false did the trick :)