Skip to content

Commit

Permalink
Fix column's "header_attr" lost on sorted column #177
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreyu committed Jan 22, 2025
1 parent 59d921c commit b89e9cd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Resources/views/themes/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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
})) %}

<th {{ block('attributes') }}>
{% set label_attr = { href: data_table_column_sort_url(data_table, column) }|merge(label_attr) %}
Expand Down

0 comments on commit b89e9cd

Please sign in to comment.