pageSize for multiple queries

On my page I run 3 different queries:

const PAGE_SIZE=10;

$pages1=new CPagination(Application::model()->count($criteria1));



I also have the same code for the other two queries (using $pages2, $pages3 and $criteria2, $criteria3).

I want all 3 queries to each have a pageSize of 10. It seems at the moment that the const PAGE_SIZE is being shared by all 3 queries.

I tried hardcoding the pageSize value on all 3 queries but that did not work either.

please, put the code (controller and view)


public function actionAdmin()


	$criteria1=new CDbCriteria;

	$criteria1->addCondition("case_assigned_to = ''");


	$pages1=new CPagination(Application::model()->count($criteria1));





	$sort1=new CSort('Application');





	$criteria2=new CDbCriteria;

	$criteria2->addCondition("case_assigned_to != ''");


	$pages2=new CPagination(Application::model()->count($criteria2));




	$sort2=new CSort('Application');



	$models2=Application::model()->with('username', 'app_status', 'app_date')->findAll($criteria2);


	$criteria3=new CDbCriteria;

	$criteria3->addCondition("application_status = '009'");


	$pages3=new CPagination(Application::model()->count($criteria3));




	$sort3=new CSort('Application');





	$this->render('admin', array(
















<?php if($total1 !=0) { ?>

<table class="dataGrid">



    <th><?php echo $sort1->link('id'); ?></th>

    <th><?php echo $sort1->link('organisation_name'); ?></th>

	<th><?php echo $sort1->link('application_date'); ?></th>

	<th>Assign To</th>





<?php foreach($models1 as $n=>$model): ?>

  <tr class="<?php echo $n%2 ? 'even' : 'odd'; ?>">

    <td><?php echo CHtml::link($model->id, array('show', 'id'=>$model->id)); ?></td>

    <td><?php echo CHtml::encode($model->organisation_name); ?></td>

	<td><?php echo CHtml::encode($model->app_date->action_date); ?></td>


		<?php echo CHtml::beginForm(); ?>

		<?php echo CHtml::dropDownList('Application[case_assigned_to]', '', User::model()->getUsers(), array('prompt'=>'')); ?>

		<?php echo CHtml::hiddenField('Application[app_id]', $model->id); ?>

		<?php echo CHtml::submitButton('Go'); ?>

		<?php echo CHtml::endForm(); ?>



      <?php echo CHtml::link('Edit', array('update', 'id'=>$model->id)); ?> | 

      <?php echo CHtml::linkButton('Delete', array(


      	  'params'=>array('command'=>'delete', 'id'=>$model->id),

      	  'confirm'=>"Are you sure to delete #{$model->id}?")); ?>



<?php endforeach; ?>




<?php $this->widget('CLinkPager', array('pages'=>$pages1)); ?>

<?php } ?>

Can you also analyze my controller code and let me know if there any simpler ways of doing it.

see this

Thanks Horacio. On that page the post by qiang says:

pageVar property: name of the GET variable storing the current page index. Defaults to ‘page’.

But I don’t have any GET variable.

I’m not sure, but try doing this

        $pages1=new CPagination(Application::model()->count($criteria1));





        $pages2=new CPagination.....






here other solution

Hi Horacio,

I had a look at that page you suggested above but I think that is not entirely relevant to what I’m trying to do. I don’t need to distinguish between active/inactive pagers, instead all pagers on the page need to be considered ‘active’.

Anyone able to help?

How can you make sort columns unique on multiple pagers that have the same fields?