kartik gridview在排序时崩溃

时间:2016-06-07 13:33:21

标签: yii2

当我尝试对子视图中的任何列进行排序时,视图将在kartik gridview中折叠为其原始状态。 Gridview的代码是 -

<?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'export' => false,
        'columns' => [
        [
            'class' => 'kartik\grid\ExpandRowColumn',
            'value' => function($model, $key, $index, $column){
                return GridView::ROW_COLLAPSED;
            },
            'detail' => function($model, $key, $index, $column){
                $searchModel = new ExpartiesSearch();
                $searchModel-> parties_district = $model-> district;
                $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

                return Yii::$app->controller->renderPartial('_exparties', [
                    'searchModel' => $searchModel,
                    'dataProvider' => $dataProvider,
                    ]);                   

                },
            ], 
            'district', 
            'sell',
            'collection',
        ],
    ]); ?>

1 个答案:

答案 0 :(得分:0)

也使用_exparties.php中的Pjax,不带'id'。像这样:

Pjax::begin(['enablePushState' => false]);

...您的代码...

Pjax::end();

可能对其他人有用。