laravel-enso / tables

Bulma themed, VueJS powered Datatable with server-side loading and JSON template setup
https://www.laravel-enso.com/examples/table
632 stars 77 forks source link

Excel export not working if you use method = POST for a table #239

Closed mauthi closed 3 years ago

mauthi commented 3 years ago

This is a bug (related to #176)

Prerequisites

Description

If you use POST as method for your table (because url for get is too long) - the excel export fails

Steps to Reproduce

  1. Add the following line the a table config (tested with vendor/laravel-enso/people/src/app/Tables/Templates/people.json) "method": "POST",
  2. Change tableData route in vendor/laravel-enso/people/src/routes/api.php from get to post
  3. Open table
  4. Click on Excel Button

Expected behavior

Export is started

Actual behavior

Request fails with status 405

"message": "The POST method is not supported for this route. Supported methods: GET, HEAD, PATCH.",
"exception": "Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException",
"file": "/Users/mauthi/coding/Enso/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php",
"line": 117,
mauthi commented 3 years ago

My error - if I change the routes file to POST (Route::post('exportExcel', ExportExcel::class)->name('exportExcel');) it's working