i have pages of result and want to default the view to last page, and found the solution here.
in controller action function,
PHP:
public function actionIndex() | |
{ | |
$dataProvider=new CActiveDataProvider('model',array( | |
'pagination'=>array( | |
'pageSize'=>10, | |
) | |
)); | |
$pager=$dataProvider->pagination; | |
$pager->itemCount=$dataProvider->totalItemCount; | |
if(!Yii::app()->request->isAjaxRequest) | |
$pager->currentPage=$pager->pageCount; | |
| |
$this->render('index',array( | |
'dataProvider'=>$dataProvider, | |
)); | |
} |
Leave a comment