0

如何从 DynaGrid 的导出菜单中隐藏某些格式。我尝试了 GridView 小部件的设置,但不起作用。格式仍然可见。

'exportConfig' => [
    GridView::CSV => ['label' => 'Save as CSV'],
    GridView::HTML => [],
    GridView::PDF => [],
]
4

1 回答 1

1

您需要在 下使用上述选项exportConfiggridOptions并且您应该只指定您希望在下拉菜单打开后可见的格式,如果您只需要CSV格式,则只需CSVexportConfig

echo DynaGrid::widget([
    'columns' => $columns,
    'storage' => DynaGrid::TYPE_COOKIE,
    'theme' => 'panel-danger',
    'gridOptions' => [
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'exportConfig'=>[
            GridView::CSV=>['label'=>'Save As'],
        ],    
        'panel' => ['heading' => '<h3 class="panel-title">Library</h3>'],

    ],

    'options' => ['id' => 'dynagrid-1'], // a unique identifier is important
]);
于 2020-02-02T14:58:38.607 回答