使用 ExpandRowColumn 加载的 Kartik 的 gridview 的导出问题

Export problems with Kartik's gridview loaded with ExpandRowColumn

我正在渲染一个 Kartik's Gridview which loads another Gridview via ajax by ExpandRowColumn 小部件。

我想使用网格工具导出这个二次加载的网格,但是当我启用导出菜单并尝试导出它时,它将下载 main 网格而不是第二个一。甚至我在第二个网格上设置的导出配置选项也没有考虑在内。我尝试为第二个网格设置自定义 id,但没有任何改变。

这是第一个网格:

```

GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => false,
        'columns' => [
            [
                'class' => 'kartik\grid\ExpandRowColumn',
                'value' => function ($model, $key, $index) { 
                    return GridView::ROW_COLLAPSED;
                },
                'detailUrl' => Url::to(['ajax-riepilogo', 'idf' => $f]),
            ],
            'descrizione',
        ],
    ]);

```

这是在 ajax-riepilogo 中生成的:

```

GridView::widget([
        'dataProvider' => $secondDataProvider,
        'id' => 'grid-riepilogo',
        'panel' => [
            'type' => 'primary',
            'heading' => false,
        ],
        'toolbar' => ['{export}'],
        'export' => [
            'showConfirmAlert' => false,
            'target' => GridView::TARGET_BLANK,
            'exportConfig' => [
                GridView::CSV => [
                    'filename' => "riepilogo',
                ],
                GridView::EXCEL => [
                    'filename' => "riepilogo',
                ],
            ],
        ],
        'summary' => false,
        'filterModel' => false,
        'columns' => [
           ...

```

两个错误:

  1. 页面中的每个网格 id 必须是唯一的
  2. exportConfig 配置属性需要处于 顶级

工作配置:

     GridView::widget([
    'dataProvider' => $secondDataProvider,
    'id' => 'grid-riepilogo-'.$unique,
    'panel' => [
        'type' => 'primary',
        'heading' => false,
    ],
    'toolbar' => ['{export}'],
    'export' => [
        'showConfirmAlert' => false,
        'target' => GridView::TARGET_BLANK,
    ],
    'exportConfig' => [
        GridView::CSV => [
            'filename' => "riepilogo',
        ],
        GridView::EXCEL => [
            'filename' => "riepilogo',
        ],
    ],
    'summary' => false,
    'filterModel' => false,
    'columns' => [
       ...