Yii Framework Forum: Yii Cgridview Order By Column Default - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii Cgridview Order By Column Default cgridview display results order by coulmn default Rate Topic: ***** 1 Votes

#1 User is offline   Sivanthi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 14-February 13
  • Location:Nagercoil, Kanya Kumari, Tamilnadu. India

Posted 15 March 2013 - 05:58 AM

return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
			'sort'=>$sort,
			'sort'=>array(
						'defaultOrder'=>'columnName DESC',
				)
		  	));

1

#2 User is offline   seenivasan 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 620
  • Joined: 17-June 12
  • Location:Chennai,TamilNadu,India.

Posted 15 March 2013 - 10:05 AM

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.
0

#3 User is offline   Sivanthi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 14-February 13
  • Location:Nagercoil, Kanya Kumari, Tamilnadu. India

Posted 16 March 2013 - 01:05 AM

View Postseenivasan, on 15 March 2013 - 10:05 AM, said:

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.
1

#4 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,082
  • Joined: 16-February 11
  • Location:Japan

Posted 16 March 2013 - 02:10 AM

/* Moved from "General Discussion for Yii 1.1.x" to "Tips, Snippets and Tutorials" */
1

#5 User is offline   salsero 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 80
  • Joined: 05-September 12
  • Location:Italia

Posted 16 April 2013 - 10:16 AM

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!!!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users