Pagination or summaryText not showing in CListView

I am using CListView to render data but I cannot get the pagination information to show.

The dataProvider looks like this:




        $sql = 'SELECT o.* from Office o';

        

        $connection=Yii::app()->db;

        $command=$connection->createCommand($sql);

        $count = $command->execute();

        

        $dataProvider=new CSqlDataProvider($sql, array(

            'keyField'=>'id',

            'totalItemCount'=>$count,

            'sort'=>array(

                'attributes'=>array('id','status','createdTime'),

                'defaultOrder'=>array('id'=>'DESC'),

            ),  

            'pagination'=> array(

                'pageSize'=>1,

            ),  

        ));



And the code to call the file looks like this:




<?php $this->widget('zii.widgets.CListView', array(

    'dataProvider'=>$dataProvider

    'itemView'=>'officeList',

    'enablePagination'=>true,

    'summaryText'=>true,

    'template'=>'{items}',

    )

); ?>



$dataProvider has three results but I’ve limited the view to one to force pagination but I’m not seeing the pagination buttons or summaryText. Does anyone have any ideas?

Hi dubby,

You have to change your ‘template’ property to something like this:




    'template'=>'{summary}{pager}{items}{pager}',



http://www.yiiframework.com/doc/api/1.1/CListView#template-detail

Excellent. Thanks for that. It answers a few questions.