2015-05-13 16:56:08 3791次浏览 1条回答 0 悬赏 20 金钱
Pjax::begin();
    echo ListView::widget([
        'dataProvider' => $commentsDataProvider,
        'layout' => "{items}\n{pager}",
        'summary' => '<div class="col-sm-12 text-right"><p class="summary">当前显示第{begin} - {end}条,共{totalCount}条。</p></div>',
        'options' => [
            'class' => 'item-commit-page row',
            'id' => $id,
        ],
        'pager' => [
            'class' => 'yii\widgets\LinkPager',
            'options' => [
                'class' => 'pagination pull-right',
            ]
        ],
        //'itemOptions' => ['class' => 'col-sm-3 single-item'],
        'itemView' => function ($model, $key, $index, $widget) {
            return $this->render('/item/_comment_one', [
                'model' => $model
            ]);
        },
    ]);
Pjax::end();

$this->registerJs('
    $.pjax.reload({container:"#w0"});
');

目的是想实现ajax分页
现在打开后 根据当前页面地址请求 http://xxx.com/aa/bb?_pjax=%23w1
页面有时候会不停的刷新。暂不清楚原因。

  • 回答于 2015-05-13 17:31 举报

    问题出现在

    $this->registerJs('
        $.pjax.reload({container:"#w0"});
    ');
    

    此处更改为事件触发就能解决无限刷新

    1 条回复
    回复于 2015-12-10 14:12 回复

    好像不对···············

您需要登录后才可以回答。登录 | 立即注册
mafeifan
经理

mafeifan

注册时间:2014-06-09
最后登录:2020-11-02
在线时长:9小时11分
  • 粉丝9
  • 金钱866
  • 威望45
  • 积分1406

热门问题