Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Order By Column 1 And 2 When Click Column 1

$
0
0
Good evening.

I've got a CGridView with 2 columns (column 1 is a foreign key).

I want when I click column 1, the CGridView is sorted by column 1 and then by column 2.

My model:

public function search()
{
.....

return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>array(
'defaultOrder'=>'FK.A, B ASC',
'attributes'=>array(
'FK'=>array(
'asc'=>'FK.A',
'desc'=>'FK.A DESC',
),
'B'=>array(
'asc'=>'B',
'desc'=>'BDESC',
),
),
),
));

.....
}

DefaultOrder is OK, but not click column order.

Any idea?

Thanks.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>