Laravel-datatables: How to make for any row several buttons

Created on 9 Jun 2018  路  2Comments  路  Source: yajra/laravel-datatables

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

  • Operating System
  • PHP 7.1
  • Laravel 5.6
  • Laravel-Datatables "yajra/laravel-datatables-oracle": "^8.6":
question

Most helpful comment

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.

All 2 comments

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mopster picture Mopster  路  3Comments

Abdulhmid picture Abdulhmid  路  3Comments

alejandri picture alejandri  路  3Comments

techguydev picture techguydev  路  3Comments

jgatringer picture jgatringer  路  3Comments