From b89e9cd50bfdbcc5ee2e9e5ebf1731081e3a24cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Wr=C3=B3blewski?= Date: Wed, 22 Jan 2025 18:11:47 +0100 Subject: [PATCH] Fix column's "header_attr" lost on sorted column #177 --- src/Resources/views/themes/base.html.twig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Resources/views/themes/base.html.twig b/src/Resources/views/themes/base.html.twig index 9376aa23..9451f691 100755 --- a/src/Resources/views/themes/base.html.twig +++ b/src/Resources/views/themes/base.html.twig @@ -409,7 +409,13 @@ {% set active_attr = active_attr|default({}) %} {% set inactive_attr = inactive_attr|default({}) %} - {% set attr = attr|merge(sorted ? active_attr : inactive_attr) %} + {% set sorted_attr = sorted ? active_attr : inactive_attr %} + + {# Merge the sorted attr with column header attr, but merge its classes. #} + {# The column header attr class is added after the sorted attr class. #} + {% set attr = attr|merge(sorted_attr|merge({ + class: (sorted_attr.class|default('') ~ ' ' ~ attr.class|default(''))|trim + })) %} {% set label_attr = { href: data_table_column_sort_url(data_table, column) }|merge(label_attr) %}