Laravel-datatables: How to set custom icon (class) on buttons

Created on 4 Feb 2020  路  1Comment  路  Source: yajra/laravel-datatables

Summary of problem or feature request

I'm wondering if there's a way to set a custom icon for the standard buttons. In particular, the font-awesome 'fa-refresh' is not part of the set. I'm looking to change it to fa-sync. Available (free) icons here: https://fontawesome.com/icons?d=gallery&q=refresh&m=free

Code snippet of problem

From MyDatable.php

 public function html()
    {
        return $this->builder()
            ->buttons(
                Button::make('create'),
                Button::make('colvis'),
                Button::make('print'),
                Button::make('reset'),
                Button::make('reload'),
            );
    }

Outputs the following:

<button class="dt-button buttons-reload" tabindex="0" aria-controls="people-table" type="button">
  <span>
    <svg class="svg-inline--fa fa-refresh fa-w-16" aria-hidden="true" focusable="false" data-prefix="fa" data-icon="refresh" ...></path>
    ...    
    </svg><!-- <i class="fa fa-refresh"></i> --> Reload
  </span>
</button>

I'd like to change fa-refresh to fa-sync and not sure the best spot to do so.

Most helpful comment

And a classic case of finding an answer immediately after posting a question.

Solution:

Button::make('reload')->text('<i class="fa fa-sync"></i> Reload'),

>All comments

And a classic case of finding an answer immediately after posting a question.

Solution:

Button::make('reload')->text('<i class="fa fa-sync"></i> Reload'),
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ruchisheth picture ruchisheth  路  16Comments

phainv picture phainv  路  16Comments

mantrax314 picture mantrax314  路  15Comments

faisalhilmi picture faisalhilmi  路  18Comments

fanjavaid picture fanjavaid  路  32Comments