Sort For Only One Cgridview

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

up…anybody? :unsure:

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' ),

                        )

                ));

}



great…it works.thanks for your solution.SOLVED :lol: