Skip to content
Icon

WARNING You're browsing the documentation for an old version of LARAVEL-DATATABLES. Consider upgrading your project to laravel-datatables 11.0.

DataTable Buttons

Export Button Group

To enable export button group, set export on the buttons array. Export button group includes excel, csv and pdf button.

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' => ['export'],
]);
}
...

Export as Excel

To enable exporting to excel, set excel on the buttons array.

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' => ['excel'],
]);
}
...

Export as CSV

To enable exporting to csv, set csv on the buttons array.

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' => ['csv'],
]);
}
...

Export as PDF

To enable exporting to pdf, set pdf on the buttons array.

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' => ['pdf'],
]);
}
...

Printable Version

To enable print button, set print on the buttons array.

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' => ['print'],
]);
}
...

Reset Button

To enable reset button, set reset on the buttons array.

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' => ['reset'],
]);
}
...

Reload Button

To enable reload button, set reload on the buttons array.

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' => ['reload'],
]);
}
...