Skip to content

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