Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions buttons/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,40 @@ class UsersDataTable extends DataTable
...
```

<a name="post-export"></a>
## Export as Excel, CSV, and PDF using POST method

To enable exporting to excel, csv, and pdf using POST method set the following on the buttons array.
This is recommended if you have a long query and if you are using IE browsers.

```php
namespace App\DataTables;

use App\User;
use Yajra\DataTables\Services\DataTable;

class UsersDataTable extends DataTable
{
//...some default stubs deleted for simplicity.

public function html()
{
return $this->builder()
->columns($this->getColumns())
->parameters([
'buttons' => ['postExcel', 'postCsv', 'postPdf'],
]);
}
...
```

And also add this code to your routes.php file.
```php
Route::resource('sample', 'SampleController@index');
Route::post('sample/export', 'SampleController@index');
...
```

<a name="print"></a>
## Printable Version

Expand Down