Does anyone know if there is a way to sort on multiple columns using sortableAttributes in CListView? I’d like to get a sort something like “country ASC, city ASC, name ASC” and call it “Sort by location” but I can’t find anywhere in the documentation where the inner options for sortableAttributes is unpacked. The only thing I can find is a way to rename a single column.
Where you implement CActiveDataProvider, you’ll want to add the sort attribute with something like
'sort'=>array(
'attributes'=>array(
'location'=>array(
'asc'=>'country ASC, city ASC, name ASC',
'desc'=>'country DESC, city DESC, name DESC',
'default'=>'desc'
),
),
'defaultOrder'=>'country ASC, city ASC, name ASC'
)
See CSort::attributes for more information on how to define sortable attributes