Where Is The Pager In Clistview?

Hi, here is a post list, then each post has a comment list.

the _view.php of the post list like this:




<div class="item">

    <div><?php echo $data->description?></div>

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

        'id' => 'comment-list'.$data->id,

        'dataProvider'=>new CArrayDataProvider($data->comments, array(

            'keyField'=>'id',

            'pagination'=>array(

                'pageSize'=>5,

             ),

        )),

        'itemView' => '/comment/_view',

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

    ));?>

</div>



so, the post list shows correctly, — with pager, but the comment list is not right. I’ve checked the webpage resource. I can see that:

there is no




<div class="pager">...</div>



in between




<div class="items">...</div>



and




<div class="keys">...</div>



which should be there.

Please what’s the problem? Where is the ‘‘pager’’?

It looks like your code is correct, how many comments are there? if it’s less than the pageSize, then the pager will not be shown.

i found the issue and a solution:

i am using infinite-scroll jquery plugin. it controls the div with class="pager". since both post-list and comment-list has the same pager classCss, so the infinite-scroll jquery plugin masses them up…

a solution is to assign different css to the pager div:

for example:




'pagerCssClass' => 'pager-post-list',

'pager' => array('nextPageCssClass'=>'pager-post-next')



hope it helps others :)