Yii Framework Forum: Pagination with zii.widgets.CListView - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Pagination with zii.widgets.CListView How to control items per page Rate Topic: -----

#1 User is offline   brown145 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 24-February 11

Posted 24 February 2011 - 03:09 AM

I was not happy with the default 10 items per page that zii.widgets.CListView was displaying for me so I tried to turn off pagination:

<ul>
<?php $this->widget('zii.widgets.CListView', array(
    'dataProvider'=>$dataProvider,
    'itemView'=>'_view',
    'enablePagination'=>false,
)); ?>
</ul>


but to my surprise it just truncated my list to 10 items without the next page option, instead of displaying them all. So two questions:
  • how do I control more advanced options like the items per page and
  • if I did just want it to list everything, should I drop this widget altogether?

0

#2 User is offline   brown145 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 24-February 11

Posted 28 February 2011 - 07:42 PM

Looks like pager property would help with this but I ended up following the example that can be seen with CPagination as it pushed the decision into the controller.
0

#3 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 01 March 2011 - 02:04 AM

You should edit the CPagination ebedded in the dataprovider.

$dataProvider->pagination->pageSize=10

4

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users