Yii Cgridview Order By Column Default


return new CActiveDataProvider($this, array(

			'criteria'=>$criteria,

			'sort'=>$sort,

			'sort'=>array(

						'defaultOrder'=>'columnName DESC',

				)

		  	));

Dear Friend

You have just displayed a snippet of code.

What do you expect from the forum members?

Is it a working code and you want to display as a tip to forum?

or

You are having any trouble with the code.

hi friend i just learned this. i posted this code to tip for new yii members.

[color="#006400"]/* Moved from "General Discussion for Yii 1.1.x" to "Tips, Snippets and Tutorials" */[/color]

thank you!!!

very useful for me ;)

i add this code if you want only give sorting capability to a column




return new CActiveDataProvider($this, array(

                        'criteria'=>$criteria,

                        'sort'=>array(

                                     'attributes'=>array(

                                                  'columnName',

                                                  ),

                                ),                                 

                        ));



Best Regards!!!