doutan3040 2013-02-01 16:13
浏览 46
已采纳

dataProvider没有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,
    ));
}
  • 写回答

2条回答 默认 最新

  • dongshu7162 2013-02-01 17:50
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害