Yii dataProvider更改没有ajax分页的分页链接

时间:2014-09-17 12:02:31

标签: php yii

我尝试更改我的dataProvider分页链接

控制器代码:

public function actionOffers()
    {
        $this->layout='column2';
        $dataProvider=new CActiveDataProvider('AmakenOffer');
        $dataProvider->pagination->pageSize = 15;

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

我的观点:

<?php $this->widget('zii.widgets.CListView', array(
    'dataProvider'=>$dataProvider,
    'itemView'=>'_viewoffers',
)); ?>

我的网址链接:

http://localhost/11copy/index.php/site/offers?AmakenOffer_page=2

我需要更改

http://localhost/11copy/index.php/site/offers?page=2

1 个答案:

答案 0 :(得分:3)

应该有效:

$provider = CActiveDataProvider('model', array(
  'pagination' => array(
    'pageSize'=>15, 
    'pageVar' => 'page'
   )
));

http://www.yiiframework.com/doc/api/1.1/CPagination#pageVar-detail

和ajax更新部分:

<?php $this->widget('zii.widgets.CListView', array(
 'dataProvider'=>$dataProvider,
 'ajaxUpdate' => false,
 'itemView'=>'_viewoffers', )); ?>