false
or null
within ExportMenu::exportConfig
. In addition, this example also shows how you can configure specific properties for a format. For example, you can control PDF output rendering by setting the pdfConfig
setting. The pdfConfig
setting within ExportMenu::exportConfig
array for the format ExportMenu::FORMAT_PDF
, will allow you to configure the settings for the kartik\mpdf\Pdf
component.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; echo ExportMenu::widget([ 'dataProvider' => $dataProvider, 'columns' => $gridColumns, 'exportConfig' => [ ExportMenu::FORMAT_TEXT => false, ExportMenu::FORMAT_HTML => false, ExportMenu::FORMAT_EXCEL => false, ExportMenu::FORMAT_PDF => [ 'pdfConfig' => [ 'methods' => [ 'SetTitle' => 'Grid Export - Krajee.com', 'SetSubject' => 'Generating PDF files via yii2-export extension has never been easy', 'SetHeader' => ['Krajee Library Export||Generated On: ' . date("r")], 'SetFooter' => ['|Page {PAGENO}|'], 'SetAuthor' => 'Kartik Visweswaran', 'SetCreator' => 'Kartik Visweswaran', 'SetKeywords' => 'Krajee, Yii2, Export, PDF, MPDF, Output, GridView, Grid, yii2-grid, yii2-mpdf, yii2-export', ] ] ], ], 'dropdownOptions' => [ 'label' => 'Export All', 'class' => 'btn btn-outline-secondary btn-default' ] ]) . "<hr>\n". GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => $gridColumns, ]);
$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.