In kartik/gridview of yii2 export link is not display its shows the #? -
i have written following code export data csv or other format using kartik/gridview plugin in yii2. when click on export button display # sign on each type of export hot fix issue.
index.php
<?php use yii\helpers\html; use yii\grid\gridview; use yii\widgets\pjax; use app\models\adminusermaster; use yii\helpers\url; use app\models\subadminroles; use kartik\export\exportmenu; /* code design coloumns */ $gridcolumns = [ ['class' => 'yii\grid\serialcolumn'], 'full_name', 'email', ['class' => 'yii\grid\actioncolumn'], ]; /* code create export menu */ echo exportmenu::widget([ 'dataprovider' => $dataprovider, 'columns' => $gridcolumns, 'target' => exportmenu::target_blank, 'fontawesome' => true, 'dropdownoptions' => [ 'label' => 'export all', 'class' => 'btn btn-default' ]]); /* code create gridview column , data action , number column */ echo \kartik\grid\gridview::widget([ 'dataprovider' => $dataprovider, 'filtermodel' => $searchmodel, 'responsive' => true, 'hover' => true, 'bordered' => false, 'floatheader' => true, 'pjax' => true, 'columns' => $gridcolumns,]); ?> /* code configured gridview module */
web.php file
'modules' => [ 'gridview' => [ 'class' => '\kartik\grid\module', //'downloadaction' => 'export', 'downloadaction' => 'gridview/export/download', ] please me how fix issue.
you need create export options csv this.
gridview::widget([ 'id' => 'kv-grid-vehicle', 'dataprovider'=>$dataprovider, 'filtermodel'=>$searchmodel, 'columns'=>$gridcolumns, 'resizablecolumns'=>true, 'containeroptions'=>['style'=>'overflow: auto'], // set when $responsive = false 'headerrowoptions'=>['class'=>'kartik-sheet-style'], 'filterrowoptions'=>['class'=>'kartik-sheet-style'], 'pjax'=>true, // pjax set true demo 'export'=>[ 'fontawesome'=>true ], // parameters demo form 'bordered'=>true, 'striped'=>false, 'condensed'=>true, 'responsive'=>false, 'hover'=>true, 'showpagesummary'=>false, 'panel'=>[ 'type'=>gridview::type_primary, ], 'persistresize'=>false, 'exportconfig'=>$defaultexportconfig, ]); ?>
and $defaultexportconfig this
$defaultexportconfig = [ gridview::csv => [ 'label' => yii::t('kvgrid', 'csv'), 'icon' => $isfa ? 'file-code-o' : 'floppy-open', 'iconoptions' => ['class' => 'text-primary'], 'showheader' => true, 'showpagesummary' => true, 'showfooter' => true, 'showcaption' => true, 'filename' => yii::t('kvgrid', 'grid-export'), 'alertmsg' => yii::t('kvgrid', 'the csv export file generated download.'), 'options' => ['title' => yii::t('kvgrid', 'comma separated values')], 'mime' => 'application/csv', 'config' => [ 'coldelimiter' => ",", 'rowdelimiter' => "\r\n", ] ], ]
may you.
Comments
Post a Comment