Cgridview First Page's Pagination


I can’t solve the following problem :

I’m using Cgridview to display a list of articles.

I’ve set the pageSize to 10 per page

It’s working fine, but if I join this table with another, the first page only displays 5 items, and the other ones are displaying 10/page

Does anyone have the solution for this ?

Thank you !!

Here’s my code :

$criteria=new CDbCriteria(array(

‘condition’=>‘is_deleted=0 AND is_valid=1’.$recherche,



$criteria->together = TRUE;

// if i add this line, then i got the pagination problem :

$criteria->with = array(

‘images’=>array(‘joinType’=>‘INNER JOIN’, ‘on’=>‘images.annonce_id =’),


$dataProvider=new CActiveDataProvider(‘Annonce’, array(






                $total = Students::model()->count($criteria);

		$pages = new CPagination($total);

                $pages->setPageSize(Yii::app()->params['listPerPage']); // Note !!

                $pages->applyLimit($criteria);  // the trick is here!

		$posts = Students::model()->findAll($criteria);





		'pages' => $pages,


		'page_size'=>Yii::app()->params['listPerPage'],)) ; // Note !!


[color="#006400"]/* moved from Bug Discussions */[/color]