Skip to content

Commit 50e8c69

Browse files
authored
Merge pull request #10 from jiwom/master
Add Post method Export Instructions.
2 parents debf5a9 + 6523b59 commit 50e8c69

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

buttons/export.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,40 @@ class UsersDataTable extends DataTable
105105
...
106106
```
107107

108+
<a name="post-export"></a>
109+
## Export as Excel, CSV, and PDF using POST method
110+
111+
To enable exporting to excel, csv, and pdf using POST method set the following on the buttons array.
112+
This is recommended if you have a long query and if you are using IE browsers.
113+
114+
```php
115+
namespace App\DataTables;
116+
117+
use App\User;
118+
use Yajra\DataTables\Services\DataTable;
119+
120+
class UsersDataTable extends DataTable
121+
{
122+
//...some default stubs deleted for simplicity.
123+
124+
public function html()
125+
{
126+
return $this->builder()
127+
->columns($this->getColumns())
128+
->parameters([
129+
'buttons' => ['postExcel', 'postCsv', 'postPdf'],
130+
]);
131+
}
132+
...
133+
```
134+
135+
And also add this code to your routes.php file.
136+
```php
137+
Route::resource('sample', 'SampleController@index');
138+
Route::post('sample/export', 'SampleController@index');
139+
...
140+
```
141+
108142
<a name="print"></a>
109143
## Printable Version
110144

0 commit comments

Comments
 (0)