I need to sort an attribute like package date, package name, status etc.
Now, I want that when user clicks on their respective title in view file. It should sort the records in ASC and DESC order for their respective attributes
Currently I am generating the list in following manner.
$criteria = new CDbCriteria();
$criteria->order = ‘t.id DESC’;
$count=Standard::model()->count($criteria);
$pages=new CPagination($count);
$pages->pageSize=Yii::app()->params[‘adminPaging’];
$pages->applyLimit($criteria);
$standarddata = Standard::model()->findAll($criteria);
$this->render(‘classes’, array(‘standarddata’ => $standarddata,
'pages' => $pages,
'standard'=>$standard,
'standard_edit'=>$standard_edit
));
But, this only shows the content on the basis of ID.
I want to make all the heading as links on view file and when user click on link it will sort the records on the basis of attribute in ASC or DESC order(toggle functionality).
I want to know that how can I use widgets or CActiveDataProvider to use this Sort feature of Yii.