-1

我有来自“feedbackmodel”的模型:

public function search($params)
{
    $query = Feedback::find();

    $dataProvider = new ActiveDataProvider([
        'query' => $query,
        'sort'=> ['defaultOrder' => ['TANGGAL'=>SORT_DESC]],
        'pagination' => array('pageSize' => 10),
    ]);

    $this->load($params);

    if (!$this->validate()) {
        // uncomment the following line if you do not want to return any records when validation fails
        // $query->where('0=1');
        return $dataProvider;
    }

    $query->andFilterWhere([
        'ID_KOMENTAR' => $this->ID_KOMENTAR,
        'id' => $this->id,
        'TANGGAL' => $this->TANGGAL,
    ]);

    $query->andFilterWhere(['like', 'KOMENTAR', $this->KOMENTAR]);

    return $dataProvider;
}

和这样的gridview代码:

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'layout'=>"{items}",
    'tableOptions' => ['class' => 'table  table-bordered table-hover'],
    'showFooter'=>false,
    'showHeader' => false,
    'pager' => [
            'firstPageLabel' => 'First',
            'lastPageLabel' => 'Last',
        ],

    'columns' => [
        [   'attribute' => 'iduser.photo',
            'format' => 'html',
            'value'=>  function($data) { return Html::img($data->imageurl) . " <p class='feedback-username'>" . $data->username . "</p>"; },
            'contentOptions'=>['style'=>'max-width: 10px; max-height: 10px'],
        ],

        [   'attribute' => 'KOMENTAR',
            'format' => 'raw',
            'value' => function($model) { return $model->KOMENTAR  ."<br><p class='feedback-date'>". $model->TANGGAL ."</p>";},
        ],

        [   'class' => 'yii\grid\ActionColumn',
            'contentOptions'=>['style'=>'width: 5px;'],
            'template' => '{update} {delete}'
        ],
    ],
]); ?>

但是为什么没有显示页面按钮,它是有限的,但我可以看到其他数据,因为我找不到下一个或上一个到另一个页面的按钮

4

1 回答 1

0

我测试你的代码

如果我删除layout=>"{items}", 页面按钮,否则不显示(我认为您的布局分配意味着只显示项目而不是寻呼机)尝试简单地评论它

<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
//'layout'=>"{items}",
'tableOptions' => ['class' => 'table  table-bordered table-hover'],
'showFooter'=>false,
'showHeader' => false,
'pager' => [
        'firstPageLabel' => 'First',
        'lastPageLabel' => 'Last',
    ],
  ..........
于 2015-08-26T16:58:11.710 回答