Skip to content

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

Buttons Quick Starter

Create Users DataTable

php artisan datatables:make Users

Update UsersDataTable

Update UsersDataTable class and set the columns and parameters needed to render our dataTable.

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()
'dom' => 'Bfrtip',
'buttons' => ['export', 'print', 'reset', 'reload'],
protected function getColumns()
return [

Example Route:

use App\DataTables\UsersDataTable;
Route::get('users', function getUsers(UsersDataTable $dataTable)
return $dataTable->render('users.index');

Example View:

Our users.index view located at resources/views/users/index.blade.php.

{!! $dataTable->table() !!}
<link rel="stylesheet" href="">
<script src=""></script>
<script src="/vendor/datatables/buttons.server-side.js"></script>
{!! $dataTable->scripts() !!}