P
P
Pavel Gogolinsky2014-07-30 11:09:55
Yii
Pavel Gogolinsky, 2014-07-30 11:09:55

How to set up pagination for CGridView?

I use yiibooster.
TbGridView pagination not showing in view

$this->widget('booster.widgets.TbExtendedGridView', array(
    'type' => 'hover condensed',
    'responsiveTable' => true,
    'pager' => array(
      'class' => 'bootstrap.widgets.TbPager',
    ),
    'filter' => $model,
    'dataProvider' => $model->search(),
    'template' => "{items}",
    'columns' => array(
      array ('name'=>'name', 'header'=>'Название'),
      array ('name'=>'brand', 'header'=>'Марка автомобиля'),
      array ('name'=>'count', 'header'=>'Количество'),
      array(
        'class'=>'booster.widgets.TbButtonColumn',
        'htmlOptions'=>array('style'=>'width: 50px'),
        'buttons'=>array(),
      ),
    ),
  ));

Code in the model
public function search() {
       ...
      return new CActiveDataProvider($this, array(
      'pagination'=>array(
        'pageSize'=>10,
      ),
      'criteria'=>$criteria,
       ));
   }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
George, 2014-07-30
@gogolinsky

change in the view in the widget parameters
'template' => "{items}{pager}",

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question