Skip to content
Icon

WARNING You're browsing the documentation for an old version of LARAVEL-DATATABLES. Consider upgrading your project to laravel-datatables 10.0.

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 class via closure.

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

Setting row class via blade string.

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

Row Attributes

Setting row class via closure.

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

Setting row class via blade string.

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