asDropdown
to false in this case. Hence the Columns Selector will not be displayed (you will need to render the exportColumnsView
on your own if needed).Not seeing the updated content on this page! Hard refresh your browser to clean cache for this page (e.g. SHIFT-F5 on Windows Chrome)
use kartik\export\ExportMenu; use kartik\grid\GridView; use kartik\helpers\Html; $customDropdown = [ 'options' => ['tag' => false], 'linkOptions' => ['class' => 'dropdown-item'] ]; $fullExportMenu = ExportMenu::widget([ 'dataProvider' => $dataProvider, 'columns' => $gridColumns, 'target' => ExportMenu::TARGET_BLANK, 'asDropdown' => false, // this is important for this case so we just need to get a HTML list 'dropdownOptions' => [ 'label' => '<i class="fas fa-external-link-alt"></i> Full' ], 'exportConfig' => [ // set styling for your custom dropdown list items ExportMenu::FORMAT_CSV => $customDropdown, ExportMenu::FORMAT_TEXT => $customDropdown, ExportMenu::FORMAT_HTML => $customDropdown, ExportMenu::FORMAT_PDF => $customDropdown, ExportMenu::FORMAT_EXCEL => $customDropdown, ExportMenu::FORMAT_EXCEL_X => $customDropdown, ], ]); echo GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => $gridColumns, 'panel' => [ 'type' => GridView::TYPE_PRIMARY, 'heading' => '<h3 class="panel-title"><i class="fas fa-book"></i> Library</h3>', ], 'exportContainer' => [ 'class' => 'btn-group mr-2 me-2' ], // the toolbar setting is default 'toolbar' => [ '{export}', ['content'=> Html::button('<i class="fas fa-plus"></i>', ['type'=>'button', 'title'=>Yii::t('kvgrid', 'Add Book'), 'class'=>'btn btn-success', 'onclick'=>'alert("This will launch the book creation form.\n\nDisabled for this demo!");']) . ' '. Html::a('<i class="fas fa-redo"></i>', ['grid-demo'], ['data-pjax'=>0, 'class' => 'btn btn-outline-secondary btn-default', 'title'=>Yii::t('kvgrid', 'Reset Grid')]) ], ], // configure your GRID inbuilt export dropdown to include additional items 'export' => [ 'itemsAfter'=> [ '<div role="presentation" class="dropdown-divider"></div>', '<div class="dropdown-header">Export All Data</div>', $fullExportMenu ] ], ]);
$gridColumns = [ ['class' => 'kartik\grid\SerialColumn'], 'id', 'name', [ 'attribute'=>'author_id', 'label'=>'Author', 'vAlign'=>'middle', 'width'=>'190px', 'value'=>function ($model, $key, $index, $widget) { return Html::a($model->author->name, '#', []); }, 'format'=>'raw' ], 'color', 'publish_date', 'status', ['attribute'=>'buy_amount','format'=>['decimal',2], 'hAlign'=>'right', 'width'=>'110px'], ['attribute'=>'sell_amount','format'=>['decimal',2], 'hAlign'=>'right', 'width'=>'110px'], ['class' => 'kartik\grid\ActionColumn', 'urlCreator'=>function(){return '#';}] ];
Comments & Discussion
Note
You can now visit the Krajee Webtips Q & A forum for searching OR asking questions OR helping programmers with answers on these extensions and plugins. For asking a question click here. Select the appropriate question category (i.e. Krajee Plugins) and choose this current page plugin in the question related to field.
The comments and discussion section below are intended for generic discussions or feedback for this plugin. Developers may not be able to search or lookup here specific questions or tips on usage for this plugin.