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 Index Column

The addIndex() method provides a quick way to add an index column to your DataTable.


Basic Usage

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

With Custom Attributes

use Yajra\DataTables\Html\Builder;
 
$html = $builder->addIndex([
'title' => '#',
'width' => '50px',
]);

Default Attributes

Attribute Default Description
data DT_RowIndex Column data key
name DT_RowIndex Column name
title # Column header
orderable false Enable/disable sorting
searchable false Enable/disable search

See Also