Yii2-Grid视图显示错误的项目数

时间:2017-12-03 05:09:26

标签: php gridview pagination yii2

我有for n in myGraph.nodes(): print n, networkx.shortest_path(graph, 1, n) ,其中有8个项目。但是计数显示grid view

enter image description here

控制器代码

Showing 1-8 of 10 items.

查看代码

public function actionViewsetpdf($id)
{
    $model = $this->findModel($id);

    $session = Yii::$app->session;
    $sqla = $session->get('result');

    $session = Yii::$app->session;
    $cnt = $session->get('count');

    $dataProvider = new SqlDataProvider([
        'sql' => $sqla,
        'totalCount'=>$cnt,
        'pagination' => [
            'pageSize' => 20,
        ],
    ]);

    return $this->render('viewsetpdf', [
        'dataProvider' => $dataProvider,
        'model' => $this->findModel($id),
        'id' => $model->id
        /*'searchModel' => $searchModel*/
    ]);


}

我已经检查了我的 <?= GridView::widget([ 'dataProvider' => $dataProvider, /*'filterModel' => $searchModel,*/ 'columns' => [ ['class' => 'yii\grid\SerialColumn'], [ 'label'=>'OGP Serial #', 'value' => 'OGP_Serial_No' ], 'Date', 'Created_By', 'Meter_Serial_Number', 'Issued_To', 'Store', 'Admin_Incharge', 'Project_Manager', 'Driver_Name', ], ]); ?> 查询和count查询,两者都返回了正确的计数和结果,即8项。我不知道为什么摘要没有正确显示。

任何帮助都将受到高度赞赏。

0 个答案:

没有答案