-1

How to create common action like 'new' which will be do one action, for example send ajax request for get some kind of information. I'm trying add action via config/packages/easy_admin.yaml

easy_admin:
  entities:
    Users:    
      list:
        actions:
          - { name: 'refresh', label: 'Refresh', icon: 'sync' }

But it's add 'refresh' link for each row in my list.

I will be grateful for example or link on information.

pembrock
  • 113
  • 1
  • 10
  • Your question is very unclear... Please edit it with specific information on what you wish to achieve. – Helenesh Feb 22 '19 at 12:05

1 Answers1

3

That's not supported natively for now.

https://github.com/EasyCorp/EasyAdminBundle/issues/1400

You have to override the default list template to add your custom buttons:

{# /templates/bundles/EasyAdminBundle/default/list.html.twig #}

{% extends '@!EasyAdmin/default/list.html.twig' %}

{% block global_actions %}
    {{ parent() }}

    {# Add your code here, for example a button on the 'Users' list #}
    {% if _entity_config.name == "Users" %}
        <div class="button-action">
            <a class="btn btn-primary" href="#">Refresh</a>
        </div>
    {% endif %}
{% endblock %}
leahpar
  • 46
  • 3