How to disable the pdf export property in kartik gridview?
I have installed the kartik gridview and it gave me the following error.
The class '\kartik\mpdf\Pdf' was not found and is required for PDF export functionality. To include PDF export, follow the install steps below. If you do not need PDF export functionality, do not include 'PDF' as a format in the 'export' property. You can otherwise set 'export' to false to disable all export functionality.
Please ensure you have installed the 'yii2-mpdf' extension. To install, you can run this console command from your application root:
php composer.phar require kartik-v/yii2-mpdf: "@dev"
I do not want to installe the mpdf. Just want to disable it. Where can I edit it?
You should set export
property to false
, it's even mentioned in error text.
use kartik\grid\GridView;
...
<?= GridView::widget([
...
'export' => false,
]) ?>
Read more in official docs.
Update:
Another way to do that is exclude PDF format from exportConfig
.
<?= GridView::widget([
'exportConfig' => [
GridView::CSV => [
...
],
... // Make sure there is no GridView::PDF
],
]) ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With