I use the bootstrap-table plugin in my Symfony project.
For the column definitions, I use the html_attr Twig function. I want to hide some columns with the visible property.
{% macro output_column(column) -%}
{% set attrs = {
'data-field': column.field,
'data-align': column.align,
'data-visible': column.visible
} %}
<th {{ html_attr(attrs) }}>
{{ column.title }}
</th>
{%- endmacro %}
But when the visible property of the column is false, then the attribute is removed. So I cannot hide the column.
It will be nice to use the same behavior as for aria-* attributes (convert the boolean false value to 'false' string).
I use the bootstrap-table plugin in my Symfony project.
For the column definitions, I use the
html_attrTwig function. I want to hide some columns with the visible property.{% macro output_column(column) -%} {% set attrs = { 'data-field': column.field, 'data-align': column.align, 'data-visible': column.visible } %} <th {{ html_attr(attrs) }}> {{ column.title }} </th> {%- endmacro %}But when the visible property of the column is
false, then the attribute is removed. So I cannot hide the column.It will be nice to use the same behavior as for
aria-*attributes (convert the booleanfalsevalue to'false'string).