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.

Row Editing Options

Row Id

Setting row id via column name.

->setRowId('id')

Setting row id via closure.

->setRowId(function ($user) {
return $user->id;
})

Setting row id via blade string.

->setRowId('{{$id}}')

Row Class

Setting row class via closure.

->setRowClass(function ($user) {
return $user->id % 2 == 0 ? 'alert-success' : 'alert-warning';
})

Setting row class via blade string.

->setRowClass('{{ $id % 2 == 0 ? "alert-success" : "alert-warning" }}')

Row Data

Setting row data via closure.

->setRowData([
'data-id' => function($user) {
return 'row-' . $user->id;
},
'data-name' => function($user) {
return 'row-' . $user->name;
},
])

Setting row data via blade string.

->setRowData([
'data-id' => 'row-{{$id}}',
'data-name' => 'row-{{$name}}',
])

Row Attributes

Setting row attribute via closure.

->setRowAttr([
'color' => function($user) {
return $user->color;
},
])

Setting row attribute via blade string.

->setRowAttr([
'color' => '{{$color}}',
])