madrani
(Hanifamustafida)
1
hi…i want to sort cgridview by id DESC.so i set like this :
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>array(
'defaultOrder'=>'id_naskah DESC'
)
));
it works in all of my cgridview…i want to make only one cgridview not DESC but ASC…where should i set that?thx
redguy
(Maciej Lizewski)
3
I gues you are referring to search() function in your model. Just extend it to:
public function search( $sortAsc = false ) {
...
...
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>array(
'defaultOrder'=>'id_naskah ' . ( $sortAsc ? 'ASC' : 'DESC' ),
)
));
}
madrani
(Hanifamustafida)
4
great…it works.thanks for your solution.SOLVED 