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.

Custom Actions

You can enable custom actions on your buttons as follows:

Update UsersDataTable class and overload the actions property. Here we are disabling the csv and pdf actions (so they cannot be fired by hijacking their request) and enabling a myCustomAction.

namespace App\DataTables;
use App\User;
use Yajra\DataTables\Services\DataTable;
class UsersDataTable extends DataTable
protected array $actions = ['print', 'excel', 'myCustomAction'];
public function html()
return $this->builder()
public function myCustomAction()
//...your code here.

Take a look at Yajra\DataTables\Services\DataTable to see how to fetch and manipulate the data (functions excel, csv, pdf).