Skip to content
Icon

WARNING You're browsing the documentation for an upcoming version of Laravel DataTables. The documentation and features of this release are subject to change.

HTML Builder Checkbox Column

The addCheckbox() method provides a quick way to add a checkbox column to your DataTable.


Basic Usage

use Yajra\DataTables\Html\Builder;
 
$html = $builder->addCheckbox();

With Custom Attributes

use Yajra\DataTables\Html\Builder;
 
$html = $builder->addCheckbox([
'title' => '<input type="checkbox" id="dataTablesCheckbox"/>',
]);

Default Attributes

[
'defaultContent' => '<input type="checkbox" />',
'title' => '<input type="checkbox" id="dataTablesCheckbox"/>',
'data' => 'checkbox',
'name' => 'checkbox',
'orderable' => false,
'searchable' => false,
'exportable' => false,
'printable' => true,
'width' => '10px',
]

Common Use Cases

Bulk Actions

// Get selected row IDs
var selectedRows = table.rows({ selected: true }).ids().toArray();

See Also