I am having more then one CGridView in one view and everything is showing fine, but when i am using the pagination on the first CGridView i am also getting results from the other grids underneath the first???
Controller
public function actionIndex()
{
$group=new CActiveDataProvider('Photos', array(
'criteria'=>array(
'select'=>'DISTINCT status',
),
));
foreach($group->data as $key => $gd)
{
$dataProvider[]=new CActiveDataProvider('Photos', array(
'criteria'=>array(
'condition'=>'user_id='.Yii::app()->user->getId().' AND status = '.$gd->status,
),
'pagination'=>array(
'pageSize'=>2,
'pageVar'=>'page'.$key,
),
));
}
$this->render('index',array(
'dataProvider'=>$dataProvider,
'group'=>$group,
));
}
View
<?php
$this->breadcrumbs=array(
'Photos',
);
$this->menu=array(
array('label'=>'Upload Photos', 'url'=>array('upload')),
array('label'=>'Manage Photos', 'url'=>array('admin')),
);
?>
<?php foreach($dataProvider as $key => $dp){ ?>
<h4><?php echo CHtml::encode($dp->data[0]->textStatus('title')); ?></h4>
<div style="font-size: 13px; margin: 0px 0px 20px 0px; width: 100%; line-height: 24px;"><?php echo CHtml::encode($dp->data[0]->textStatus('comment')); ?></div>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'photos-grid',
'dataProvider'=>$dp,
'columns'=>array(
array(
'type'=>'image',
'value'=>'"images/thumbnails/".$data->id."_thumb.jpg"',
'htmlOptions'=>array('class'=>'grid-thumb'),
),
),
)); ?>
<?php } ?>