duanci6484 2014-11-26 16:21
浏览 25

与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...

  • 写回答

1条回答 默认 最新

  • dongzhuang6247 2014-11-26 20:16
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?