Problem with CLinkPager

Hi All,

I am having difficulty getting my CLinkPager to properly paginate my list. Instead of splitting my items into multiple pages it just puts them all onto one page. It seems to be able to tell how many pages it needs because it puts the right number of pages in the pager at the bottom but all the items end up on the first page.

My Controller Code:




...

 $pins = $pinCollection->findAll();

			

			

            $criteria = $pinCollection->getDbCriteria();

			

			if($criteria){

				error_log(json_encode($criteria));

			}

			

			$item_count = count($pins);

	        //$item_count = count(Pin::model()->count($criteria));

			

	                

	        $pages = new CPagination($item_count);

	      	    

	        $pages->setPageSize(20);

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

	        

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

	                'pins' => $pins,

	               'item_count'=>$item_count,

	                'page_size'=>50,

	                

	                'pages'=>$pages,

	        ));




$pins is the whole list of items that I want to display

My View Code:




<?php if ($pins): ?>


    <table id="pinsDataGrid">

        <?php foreach ($pins as $_pin): ?>

        <tr>

            <td width="23">

                <?php

                echo CHtml::image(Yii::app()->baseUrl . '/images/arrow.png', 'Drag to a folder or category', array(

                    'class' => 'draglist',

                    'title' => 'Drag to a folder or category',

                ));

                ?>

               ETC..........

        </tr>

        <?php endforeach; ?>

    </table>

    

    <?php

    $this->widget('CLinkPager', array(

            'currentPage'=>$pages->getCurrentPage(),

            'itemCount'=>$item_count,

            'pageSize'=>$page_size,

            'maxButtonCount'=>5,

            //'nextPageLabel'=>'My text >',

            'header'=>'',

        

        ));


?>

        

   

    

<?php endif; ?>




Thanks in advance


//$item_count = count($pins);

$item_count = count(Pin::model()->count($criteria));

Work?

No, unfortunately that makes the pager think that there is only one item to put into the list and it still dumps all the items onto the first page but it does not display the pager at the bottom.

I am trying to use the CListPager Widget inside of another widget. Could that cause an issue?