私はdatatables yajra/laravel-datatablesパッケージを使用します。私はほとんどそこにありますが、削除ボタンはテキストで表示されます。Laravel Datatables複数のアクションの編集/削除、テキストとしての削除の削除
ボタンまたはリンクとして表示するにはどうすればよいですか?
データ:
return Datatables::eloquent(Product::query())
->addColumn('action', function($row) {
return '<a href="/prodicts/'. $row->id .'/edit" class="btn btn-primary">Edit</a>';
})
->addColumn('delete', function ($row) {
return '<a href="/products/show/1">delete</a>';
})
->make(true);
のJs:
$(document).ready(function() {
oTable = $('#users').DataTable({
"processing": true,
"serverSide": true,
responsive: true,
columnDefs: [
{ responsivePriority: 1, targets: 1 },
{ responsivePriority: 2, targets: -2 },
{ responsivePriority: 3, targets: -1 }
],
"ajax": "http://admin/products",
"columns": [
<?php echo $string; ?>
{data: 'action', name: 'action', orderable: false, searchable: false},
{data: 'delete', name: 'delete', orderable: false, searchable: false}
],
結果:あなたの削除アンカーにclass="btn btn-danger"
を追加
のthnx!しかし、解決策が見つかりました。 – Bas