Yii Framework Forum: CGridView Sort? - Yii Framework Forum

Jump to content

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

CGridView Sort? Rate Topic: -----

#1 User is offline   queej 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 04-February 10

Posted 27 February 2010 - 11:42 PM

Can anyone point me to an example of a CGridView with sortable columns? I have set the columns sortable and the enableSorting flag to true. I think I need to specify a 'sort' condition in the relevant controller as well, but I can't figure out the syntax.

Thanks in advance.
0

#2 User is offline   bettor 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 751
  • Joined: 02-February 09

Posted 28 February 2010 - 02:53 AM

View Postqueej, on 27 February 2010 - 11:42 PM, said:

Can anyone point me to an example of a CGridView with sortable columns? I have set the columns sortable and the enableSorting flag to true. I think I need to specify a 'sort' condition in the relevant controller as well, but I can't figure out the syntax.

Thanks in advance.


try:

$dataProvider=new CActiveDataProvider('model', array(
   'criteria'=>array(something here),
   'sort'=>array('item1','item2','item3'),//here is your deal
   'pagination'=>array(
	'pageSize'=>self::PAGE_SIZE,
   ),
)


best,
bettor
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