1

我希望他们可以帮助我解决在 PDF 文件中导出许多元素时遇到的问题。

当您导出它时,文件会在一张纸上创建和生成,并且由于有 100 个或更多产品,因此您什么也看不到 pdf 文件。有人可以帮我弄这个吗?还是以前发生过?感谢大家的帮助。

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'showPageSummary'=>false,
    'responsiveWrap'=>true,
    'condensed'=>true,
    'pjax'=>false, //Deshabilitado por doble pjax
    'striped'=>true,
    'hover'=>true,
    'panel'=>['type'=>'primary', 'heading'=>'Recibos'],
    'toolbar'=>[
        '{export}',
        '{toggleData}'
    ],
    'export' =>[
        'target'=>'_self',
        'fontAwesome' => true,
        'label' => 'Exportar',
        'dropdownOptions' => [
            'class' => 'btn btn-default'
        ],
        // 'onInitSheet' => function (PHPExcel_Worksheet $sheet, $grid) {
        //     $sheet->getDefaultStyle()->applyFromArray(['borders' => [ 'allborders' => ['style' => PHPExcel_Style_Border::BORDER_THIN ]]]);

        //     },
    ],
    'exportConfig'=> [
        GridView::EXCEL=>[
            'filename' =>  $this->title,
            ],
        GridView::PDF=>[
            'filename' =>  $this->title,
            ],
        GridView::TEXT=>[
            'filename' =>  $this->title,
            ],
        GridView::HTML=>[
            'filename' =>  $this->title,
            ],
    ],
    'columns' => [
        ['class'=>'kartik\grid\SerialColumn'],
        // [
        //     'class'=>'kartik\grid\ExpandRowColumn',
        //     'width'=>'50px',
        //     'value'=>function ($model, $key, $index, $column) {
        //         return GridView::ROW_COLLAPSED;
        //     },
        //     'detail'=>function ($model, $key, $index, $column) {
        //         // echo '<pre>';
        //         // print_r($model);
        //         // die;
        //         $searchModel= new ReciboDetalleSearch();              
        //         //$searchModel->id_recibo = $model->id;
        //         // $searchModel->id_recibo = 7;
        //         // echo '<pre>';
        //         // print_r($id);
        //         // die;
        //         $dataProvider= $searchModel->search(Yii::$app->request->queryParams);
        //         // echo '<pre>';
        //         // print_r($dataProvider);
        //         // die;
        //         return Yii::$app->controller->renderPartial('/recibo-detalle/index', [
        //             'searchModel' => $searchModel,
        //             'dataProvider' => $dataProvider
        //         ]);
        //     },
        //     'headerOptions'=>['class'=>'kartik-sheet-style'], 
        //     'expandOneOnly'=>true
        // ],
        [
            'attribute'=>'factura', 
            'value'=>'factura',
            'group'=>true, 
            'subGroupOf'=>1,   
            'label' => 'Recibo'

        ],
        [
            'attribute'=>'id_cliente',
            'value'=>'id_cliente',
            'group'=>true,  
            'subGroupOf'=>1,   
        ],
        [
            'attribute'=>'id_ciudad',
            'value'=>'id_ciudad',
            'group'=>true,  
            'subGroupOf'=>1,
        ],
        [
            'attribute'=>'fecha',
            'value'=>'fecha',
            'group'=>true, 
            'subGroupOf'=>1,
            'filterType'=> GridView::FILTER_DATE,
            'filterWidgetOptions'=>[
                    'pluginOptions' => [
                        'autoclose'=>true,
                        'format'=>'yyyy-mm-dd',
                    ]
            ], 
        ],
        [
            'attribute'=>'r_eliminado',
            'value'=>'r_eliminado',
            'group'=>true, 
            'subGroupOf'=>1,
            'hiddenFromExport'=> true,
        ],
        //Detalle
        [
            'attribute'=>'id_producto',
            'value'=>'id_producto',
            'label'=>'Producto'
        ],
        [
            'attribute'=>'rd_eliminado',
            'value'=>'rd_eliminado',
            'hiddenFromExport'=> true,
        ],
        [
            'attribute'=>'gestionado', 
            'value'=>'gestionado',
            'width'=> '80px',
            'hiddenFromExport'=> true,
        ],
        [
            'class' => 'kartik\grid\ActionColumn',
            'header'=> 'Acciones',
            'headerOptions'=> ['style'=>'text-align:center'],
            'contentOptions'=> ['style'=>'text-align:center'],
            'template'=>'{delete} {view} {update} {gestionar}',
            'options' =>['width'=> '100px'],
            'hiddenFromExport'=> true,
            'buttons'=>[
                    'gestionar'=> function($url, $model)
                    {
                        return Html::a(
                            '<span class = "glyphicon glyphicon-tasks "> </span>', 
                            $url,
                            [
                                'title'=>Yii::t('app','Gestionar'),
                                'class'=>'gestionargarantias',
                            ]
                        );

                    }
            ],
            'urlCreator' => function($action, $model, $key, $index) {
            if ($action === 'gestionar') {
                    $url = Yii::$app->request->baseUrl.'/gestion/create?id_recibo='.$model['id'].'&id_recibo_detalle='.$model['id_recibo_detalle'];


                return $url;
            }
            if ($action === 'view') {                    

                    $url = Yii::$app->request->baseUrl.'/recibo/view?id='.$model['id'];


                return $url;
            }
            if ($action === 'update') {                    

                    $url = Yii::$app->request->baseUrl.'/recibo/update?id='.$model['id'];


                return $url;
            }
            if ($action === 'delete') {                    

                    $url = Yii::$app->request->baseUrl.'/recibo/delete?id='.$model['id'];

                return $url;
            }
          }
        ],
        // [
        //     'class' => '\kartik\grid\CheckboxColumn'
        // ]
    ],

http://imgur.com/a/xaEUU

4

0 回答 0