Skip to content

Allow sorting the datagrid on small screens - #7789

Open
gbere wants to merge 1 commit into
EasyCorp:5.xfrom
gbere:add_sort_modal_on_small_screens
Open

Allow sorting the datagrid on small screens#7789
gbere wants to merge 1 commit into
EasyCorp:5.xfrom
gbere:add_sort_modal_on_small_screens

Conversation

@gbere

@gbere gbere commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Closes #7788

Below 768px the theme hides the datagrid header
(assets/css/easyadmin-theme/datagrids.css), and the column sort links live
only in that header, so listings can't be sorted on phones.

This adds a "Sort" button next to the other index page actions, shown only
below 768px, which opens a modal listing the sortable columns. Each item links
to the same URL the header link would generate and toggles between ascending
and descending, so both UIs stay in sync.

Details:

  • New sort_actions block in crud/index.html.twig and a new
    crud/includes/_sort_modal.html.twig, following the same pattern as the
    filters modal.
  • No new CSS and no asset rebuild: it reuses the ea:Modal component, the
    existing internal:sort-* icons and Bootstrap's list-group.
  • The button and the modal are only rendered when the current page has
    sortable fields, so empty listings are unaffected.
  • New datagrid.sort and datagrid.sort_by keys, translated in all locales.
  • Functional test in tests/Functional/Default/Sort/SortModalTest.php checking
    that the modal links match the datagrid header links, that they toggle the
    sort direction and that nothing is rendered when there are no results.
button modal

The datagrid header is hidden below 768px, so its column sort links are
unreachable on phones. Add a 'Sort' button next to the other index page
actions, visible only on small screens, that opens a modal listing the
sortable columns and toggling their sort direction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow sorting the datagrid on small screens

1 participant