Yii Framework Forum: Yii-Bootstrap: Displaying More Than 10 Rows Per Page In Tbgridview - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii-Bootstrap: Displaying More Than 10 Rows Per Page In Tbgridview How to display more than 10 rows per page in TbGridView Rate Topic: -----

#1 User is offline   montalbano 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 21-April 11

Posted 06 February 2013 - 04:14 PM

Hello community,

I'm using the yii-bootstrap extension and I'm more than happy!
However, my table with TbGridView shows only 10 rows per page, regardless if pagination is enabled or not. Can this behaviour be change to either some higher value or preferable a value which can be chosen by the user?

Here's my code:
<?php $this->widget('bootstrap.widgets.TbGridView', array(
    'type'=>'striped condensed',
    'dataProvider'=>$dataProvider,
    'template'=>"{summary}{items}{pager}",
	'enablePagination' => true,
	'summaryText'=>'Displaying {start}-{end} of {count} results.',
    'columns'=>array(
        array('name'=>'valuta', 'header'=>'Valuta'),
        array('name'=>'description', 'header'=>'Description'),
        array('name'=>'amount', 'header'=>'Amount'),
        array(
            'class'=>'bootstrap.widgets.TbButtonColumn',
            'htmlOptions'=>array('style'=>'width: 50px'),
        ),
    ),
)); ?>

0

#2 User is offline   luk1999 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 20-April 11
  • Location:Poland

Posted 07 February 2013 - 02:23 AM

How do you set pagination size? Please show your code.

This extension allows to choose pagination size by user:
http://www.yiiframew...nsion/pagesize/
0

#3 User is offline   montalbano 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 21-April 11

Posted 07 February 2013 - 02:47 PM

View Postluk1999, on 07 February 2013 - 02:23 AM, said:

How do you set pagination size? Please show your code.

This extension allows to choose pagination size by user:
http://www.yiiframew...nsion/pagesize/


I was not aware that pagination behaviour could be coded, thanks for pointing me to the right direction!

Changing the return statment of function 'search' of the corresponding controller to the following code solved my problem:
return new CActiveDataProvider($this, array(
	'pagination' => array(
	     'pageSize' => 25,
	),
	'criteria'=>$criteria,
));


@all: Check this wiki entry for more information about pagination.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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