kartik-v / yii2-widgets

Collection of useful widgets for Yii Framework 2.0
http://demos.krajee.com/widgets
Other
558 stars 175 forks source link

ExportMenu / GridView #339

Closed Thurcloud closed 7 years ago

Thurcloud commented 7 years ago

My Problem: No header/footer/page-number in (pdf) Export. Pdf is generated, rows and data-values are ok, but nothing else:

<?= ExportMenu::widget([
           'dataProvider' => $dataProvider,
           'columns' => [
                'Titel',
                'Komponist',
                'Arrangeur',
           ] , 
           'exportConfig' => [
               ExportMenu::FORMAT_TEXT => false,
               ExportMenu::FORMAT_CSV => false,
               ExportMenu::FORMAT_HTML => false,
               ExportMenu::FORMAT_EXCEL => false,
           ],
         ]) ;
  ?>
<?=  GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
                        'Titel',
                        'Komponist',
                        'Arrangeur',
                     ],
            'exportConfig' => [
                    GridView::PDF => [
                        'showHeader' => true,
                        'showPageSummary' => true,
                        'showFooter' => true,
                        'showCaption' => true,
                        'filename' => 'export_pdf',
                        'alertMsg' => 'The PDF export file will be generated for download.',
                        'options' => ['title' => 'Portable Document Format'],
                        'mime' => 'application/pdf',
                        'config' => [
                            'mode' => 'c',
                            'format' => 'A4-P',
                            'destination' => 'D',
                            'marginTop' => 20,
                            'marginBottom' => 20,
                            'methods' => [
                                'SetHeader' => [
                                    ['odd' => 'ggggggggggg', 'even' => 'ffffffffffff']
                                ],
                                'SetFooter' => [
                                    ['odd' => 'dfdfdfdf', 'even' => 'fgfgfgfgfddddddd']
                                ],
                            ],
                            'options' => [
                                'title' => 'ssssssssssssssssssssssssssssss',
                                'subject' => Yii::t('kvgrid', 'PDF export generated by kartik-v/yii2-grid extension'),
                                'keywords' => Yii::t('kvgrid', 'krajee, grid, export, yii2-grid, pdf')
                            ],
                            'contentBefore'=>'aaaaaaaaaaaaaaaa',
                            'contentAfter'=>'sssssssssssssssssssssssssss'
                        ]
                    ],
        ],
    ]); ?>    

without exportConfig block, i have the same problem, no default-values are printed

Thanks for help... e10

Thurcloud commented 7 years ago

Export Menu and GridView Export is NOT the same. Toolbar AND Panel must be configured, otherwise there are no Toolbar Buttons visible...