mariobgr
mariobgr

Reputation: 2201

Pagination with Yii

I have some experience with Yii from an year ago, but I cannot solve this simple task for a website I have to take over as developer;

I have the following (very simplified):

CONTROLLER

$data = $this->webshop->$funcname($_POST['fromDate'],$_POST['toDate'],$_POST['category']);
//this may contain thousands of rows

$this->render('index', array(
    'model' => $this->oStatForm,
    'data' => $data,
    'sum' => $sum,
));

VIEW

<div class="gridview" id="stat_grid">
    <?php echo $this->renderPartial('table',array('data'=>$data)); ?>
</div> 

and in the table there is a foreach which prints the table rows. I have to implement pagination in the whole thing... but I have no idea how to do this, since POST is used. CLinkPager was my first try, but it works with GET...

Upvotes: 0

Views: 73

Answers (1)

Maug Lee
Maug Lee

Reputation: 915

I recommend you using CGridView with CActiveDataProvider and all pagination, filtering, etc. will be done automatically.

Upvotes: 1

Related Questions