yii2-widget-datatables
yii2-widget-datatables copied to clipboard
Buttons copy, csv, xls, pdf don't show in google chrome
I used that code, i can see the buttons in mozilla but in google chrome i can see only print button
"tableTools"=>[
"aButtons"=> [
[
"sExtends"=> "copy",
"sButtonText"=> Yii::t('app',"Copiar")
],
[
"sExtends"=> "csv",
"sButtonText"=> Yii::t('app',"CSV")
],
[
"sExtends"=> "xls",
"oSelectorOpts"=> ["page"=> 'current']
],
[
"sExtends"=> "pdf",
"sButtonText"=> Yii::t('app',"PDF")
],
[
"sExtends"=> "print",
"sButtonText"=> Yii::t('app',"Imprimir")
],
],
],
i'm fix issue
modify file datatables.php
then, download file js dan css in https://datatables.net/extensions/buttons/examples/initialisation/export.html, or using CDN
add css and js in appasset.php
public $css = [ 'css/site.css', ' https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css', 'https://cdn.datatables.net/buttons/1.5.1/css/buttons.dataTables.min.css', ]; public $js = [ 'js/FileSaver.js', ' https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js', 'https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js', 'https://cdn.datatables.net/buttons/1.5.1/js/buttons.flash.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js', 'https://cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js', 'https://cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js', ];
in config datatables widget
i'm fix issue modify file datatables.php
then, download file js dan css in https://datatables.net/extensions/buttons/examples/initialisation/export.html, or using CDN add css and js in appasset.php
public $css = [ 'css/site.css', ' https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css', 'https://cdn.datatables.net/buttons/1.5.1/css/buttons.dataTables.min.css', ]; public $js = [ 'js/FileSaver.js', ' https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js', 'https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js', 'https://cdn.datatables.net/buttons/1.5.1/js/buttons.flash.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js', 'https://cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js', 'https://cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js', ];
in config datatables widget
terimakasih