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 IDsvar selectedRows = table.rows({ selected: true }).ids().toArray();
See Also
- HTML Builder - Main HTML Builder documentation
- HTML Builder Column - Column configuration