yajra / laravel-datatables

jQuery DataTables API for Laravel
https://yajrabox.com/docs/laravel-datatables
MIT License
4.75k stars 859 forks source link

How to make for any row several buttons #1768

Closed sergeynilov closed 1 year ago

sergeynilov commented 6 years ago

Summary of problem or feature request

Hello, I get this example https://datatables.yajrabox.com/eloquent/add-edit-remove-column to make for any row in datatable several buttons, like:

        get())

            ->editColumn('action', '<a href="/admin/articles/edit/{{$id}}"><i class="voyager-edit"></i></a>')
            ->editColumn('action_delete', '<a href="#" onclick="javascript:deleteArticle()"><i class="voyager-trash"></i></a>')

        ->make(true);

and in template :

                columns: [
                ...
                    { data: 'action', name: 'action', orderable: false, searchable: false },
                    { data: 'action_delete', name: 'action_delete', orderable: false, searchable: false }

But I see the second column as a text: https://imgur.com/a/Ru1HC2l

Which is the right way? I need to add several buttons of similar type...

Thanks!

System details

yajra commented 6 years ago

Hi @sergeynilov,

On latest version, you need to specify columns with html using:

->rawColumns(['action', 'action_delete'])

action is escaped by default but if multiple columns have html, you need to redeclare it on the array.

See https://yajrabox.com/docs/laravel-datatables/master/raw-columns for ref.

Artistan commented 5 years ago

seems to be an issue through other areas https://github.com/yajra/laravel-datatables/issues/1898

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 7 days since being marked as stale.