yajra / laravel-datatables

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

Post Excel not working, documentation incomplete #3117

Closed bramgrootjen closed 8 months ago

bramgrootjen commented 10 months ago

Summary of problem or feature request

Post excel doesn't show a button. The excel button does show up, the post excel button doesn't.

The I followed the documentation to a tee but as usual the documentation is incomplete.

Why not just write readable PHP so we can see what the options etc are?

Code snippet of problem

 public function html(): HtmlBuilder
    {
        return $this->builder()
            ->setTableId('tickets-table')
            ->addTableClass('bg-white')
            ->columns($this->getColumns())
            ->fixedHeader()
            ->minifiedAjax()
            ->orderBy(1)
            ->lengthChange()
            ->pageLength(50)
            ->paging(true)
            ->responsive()
            ->addTableClass('table table-rounded gy-6 gs-7 table-hover w-100')
            ->dom('lBfrtip')
            ->buttons([
                Button::make(['postExcel']),
                Button::make(['excel']),
            ]);
    }

-->

System details

    "yajra/laravel-datatables-buttons": "^9.0.10",
    "yajra/laravel-datatables-oracle": "^10.1.3"
yajra commented 10 months ago

Did you published the buttons.server-side.js script included in the package?

You can also pass the string for the type of button to make:

Button::make('postExcel'),
Button::make('excel'),

Why not just write readable PHP so we can see what the options etc are?

Yes, this is what I have in my projects. Something like ExcelButton::make(), etc... was not able to publish it on open source though.

bramgrootjen commented 9 months ago

Thanks! I was missing the javascript file.

The code is really magic, no exceptions, no errors. DI with proper extensions etc would really help.

github-actions[bot] commented 8 months ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 8 months ago

This issue was closed because it has been inactive for 7 days since being marked as stale.