EasyCorp / EasyCorp/EasyAdminBundle

Empty "Actions" column shown in index when a row has no enabled actions

Open Beginner friendly
#7,810 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
4.3k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
11

Description

Description

On the INDEX page, EasyAdmin always renders the trailing "Actions" table column for every row, even when the entity has no actions available at all (e.g. all of NEW / EDIT / DELETE disabled, and DETAIL not added to the row). The result is an empty, wasted column that shows nothing and adds horizontal clutter — especially noticeable on a read-only list.

Root cause

In templates/crud/index.html.twig the td is unconditionally emitted, while its content is gated on the actions count:

<!-- line 168 -->
<td class="actions {{ ea.crud.showEntityActionsAsDropdown ? 'actions-as-dropdown' }}">
    {% if entity.actions.count > 0 %}
        ... render the action menu ...
    {% endif %}
</td>

When entity.actions.count == 0 the cell is rendered empty (and this is also an unused empty th header).

Expected behaviour

When no row action is available for an entity (no enabled actions across the table), the Actions column (both the header th and every row td) should be omitted entirely, rather than rendered empty.

Suggested fix

Only render the Actions th/td when at least one entity has actions, e.g. compute a page-level flag (like the existing has_batch_actions) such as {% set has_entity_actions = ... %} and wrap the header/row cell in it.

Reproduction steps

  1. Create a CRUD controller.
  2. Disable all actions that would appear on the index rows:
return $actions
    ->disable(Action::DELETE)
    ->remove(Action::INDEX, Action::NEW)
    ->remove(Action::INDEX, Action::EDIT)
    ->remove(Action::DETAIL, Action::EDIT);
  1. Open the INDEX page — a trailing empty "Actions" column is shown.

Environment

  • EasyAdmin v5.5.1
  • Symfony v7.4.17
  • PHP 8.3
  • Browser Firefox / Chromium (verified headless)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in templates/crud/index.html.twig and reproduce the INDEX page with all row actions disabled as described. Inspect the Actions header and row cell conditions, then verify that both are omitted when no entity has actions while remaining available when at least one row action exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.