Hi,
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,
'select'=>'t.*'
));
$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 = t.id'),
);
$dataProvider=new CActiveDataProvider('Annonce', array(
'pagination'=>array(
'pageSize'=>10,
),
'criteria'=>$criteria,
));
Page 1 of 1
Cgridview First Page's Pagination
#2
Posted 02 March 2013 - 12:19 AM
$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);
$this->render('manage',array('model'=>$model,
'list'=>$posts,
'pages' => $pages,
'item_count'=>$total,
'page_size'=>Yii::app()->params['listPerPage'],)) ; // Note !!
Rajith Ramachandran,
Wiwo inc.
| Mobile: 919995504508
Wiwo inc.
| Mobile: 919995504508
Share this topic:
Page 1 of 1

Help













