Luciano Nascimento
Luciano Nascimento

Reputation: 2600

dataProvider Pagination without CGridView

How to show the pagination in the view, with own design, using dataProvider? Im not using CGridView to show dataProvider items.

Controller.php:

public function actionIndex()
{
    $dataProvider=new CActiveDataProvider('Projects', array(
        'criteria'=>array(
        ),
        'pagination'=>array(
            'pageSize'=>Yii::app()->params['itemsPerPage'],
        ),
    ));

    $this->render('index',array(
        'dataProvider'=>$dataProvider,
    ));
}

Upvotes: 0

Views: 752

Answers (2)

dInGd0nG
dInGd0nG

Reputation: 4114

You can use either ClinkPager or CListPager render a pager. Below is an example using CLinkPager

$this->widget('ClinkPager',array('pages'=>new CPagination(100)));

Upvotes: 1

HesamDadafarin
HesamDadafarin

Reputation: 571

All the CGridView, CListView and .. use a widget called, CLinkPager

Check here for more info

It also gives good example in the comments about using it in controller and comment. I'm sure you can easily adopt your dataprovider to CLinkPager. Good luck. Read the public properties, you can even use your own CSS, for different pages.

Upvotes: 3

Related Questions