0

Yii:2.0.16-dev

"minimum-stability": "dev",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": "~2.0.14",
        "yiisoft/yii2-bootstrap4": "@dev",
        "yiisoft/yii2-swiftmailer": "~2.0.0",
        "kartik-v/yii2-grid": "dev-master",
        "kartik-v/yii2-editable": "@dev",
        "kartik-v/yii2-widgets": "dev-master",
        "kartik-v/yii2-bootstrap4-dropdown": "@dev",
        "2amigos/yii2-ckeditor-widget": "^1.0@dev",
        "lavrentiev/yii2-toastr": "dev-master",
        "kartik-v/yii2-widget-fileinput": "@dev",
        "kartik-v/yii2-widget-datepicker": "@dev",
        "kartik-v/yii2-widget-timepicker": "dev-master",
        "kartik-v/yii2-dialog": "@dev",
        "kartik-v/yii2-field-range": "dev-master",
        "kartik-v/yii2-export": "dev-master",
        "kartik-v/yii2-popover-x": "dev-master",
        "kartik-v/yii2-money": "dev-master",
        "kartik-v/yii2-dynagrid": "@dev"
    },

我的代码:

<?php

$gridColumn = [
   .........
   .........
    [
        'class' => 'kartik\grid\ExpandRowColumn',
        'width' => '50px',
        'value' => function ($model, $key, $index, $column) {
            return GridView::ROW_COLLAPSED;
        },
        'detail' => function ($model, $key, $index, $column) {
            return "demo here";
            //return Yii::$app->controller->renderPartial('_expand-row-details', ['model' => $model]);
        },
        'headerOptions' => ['class' => 'kartik-sheet-style'],
        'expandOneOnly' => true
    ],
   ..........
   ..........
];


        $dynagrid = DynaGrid::begin([
            'columns' => $gridColumn,
            'theme'=>'panel-primary',
            'showPersonalize'=>true,
            'storage' => 'session',
            'gridOptions'=>[
                'dataProvider'=> $dataProvider,
                'filterModel'=> $searchModel,
                'showPageSummary'=>true,
                'floatHeader'=>true,
                'floatHeaderOptions'=>['scrollingTop'=> 50],
                'pjax'=>true,
                'responsiveWrap'=>true,
                'toolbar' =>  [
                    ['content'=>
                        $actionButtons
                    ],
                    ['content'=>'{dynagridFilter}{dynagridSort}{dynagrid}'],
                    '{export}',
                ],
                'persistResize' => true,
            ],
            'options'=>['id'=>'dynagrid-1'] // a unique identifier is important
        ]);
        if (substr($dynagrid->theme, 0, 6) == 'simple') {
            $dynagrid->gridOptions['panel'] = false;
        }  
        DynaGrid::end();
    ?>

在此处输入图像描述

4

0 回答 0