yajra / laravel-datatables

jQuery DataTables API for Laravel
https://yajrabox.com/docs/laravel-datatables
MIT License
4.76k stars 858 forks source link

Export buttons except EXCEL #2557

Closed gidaban closed 3 years ago

gidaban commented 3 years ago

Summary of problem or feature request

Hello guys. I am facing some problem with excel button. All others buttons works well except export to excel.

Code snippet of problem

    public function html()
    {
        return $this->builder()
            ->setTableId('amenities-table')
            ->columns($this->getColumns())
            ->responsive(true)
            ->buttons(["copy", "csv", "excel", "pdf", "print", "colvis"])
            ->minifiedAjax()
            ->dom('Bfrtip')
            ->orderBy(1, 'asc');
    }

also please check what files are attached already.

js files

require('admin-lte/plugins/datatables/jquery.dataTables.min')
    require('admin-lte/plugins/datatables-bs4/js/dataTables.bootstrap4.min')
    require('admin-lte/plugins/datatables-responsive/js/dataTables.responsive.min')
    require('admin-lte/plugins/datatables-responsive/js/responsive.bootstrap4.min')
    require('admin-lte/plugins/datatables-buttons/js/dataTables.buttons.min');
    require('admin-lte/plugins/datatables-buttons/js/buttons.print.min')
    require('admin-lte/plugins/datatables-buttons/js/buttons.bootstrap4.min');
    require('admin-lte/plugins/datatables-buttons/js/buttons.html5.min')
    require('admin-lte/plugins/datatables-buttons/js/buttons.print.min')
    require('admin-lte/plugins/datatables-buttons/js/buttons.colVis.min')
    require('admin-lte/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min');
    require('admin-lte/plugins/jszip/jszip.min');
    require('admin-lte/plugins/pdfmake/pdfmake.min');
    require('admin-lte/plugins/pdfmake/vfs_fonts');

css files

@import "~admin-lte/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css";
@import "~admin-lte/plugins/datatables-responsive/css/responsive.bootstrap4.min.css";
@import "~admin-lte/plugins/datatables-buttons/css/buttons.bootstrap4.min.css";

System details

yajra commented 3 years ago

I think you are using the client side excel button. Better ask on https://datatables.net/forums/ since this is out of scope of the package. Thanks!

yajra commented 3 years ago

But if you want to use the server-side equivalent buttons, you should also include this script: https://github.com/yajra/laravel-datatables-buttons/blob/4.0/src/resources/assets/buttons.server-side.js.

See https://yajrabox.com/docs/laravel-datatables/master/buttons-starter for a ref.