Views strips HTML from content when grouping fields in columns in Table Format

Created on 1 November 2016, over 8 years ago
Updated 2 May 2024, about 1 year ago

I just noticed that when I select a table format, and seek to group one or more fields into a single column, that the content from the field being grouped is stripped of all HTML. It would be nice to at least get a span wrapped around that content, because right now, there are just three text strings running together, without even a space between them.

Does anyone know if there is a way around this default behavior in the Views UI? I have looked all through the table settings and the field settings and can't see anything that would permit me to get something wrapped around the content for the fields being so grouped. Ideally, I would like at least a span or div wrapped around those items being grouped, so that the won't run together.

πŸ› Bug report
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 4 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States RKopacz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia pameeela

    I'm not sure whether something has changed, but I can't reproduce the HTML stripping here. If I have a field with HTML, it displays the same way whether it its own column or grouped.

    Fields displayed in the same column:

    <td headers="view-title-table-column--n_pwIg-AmyE" class="views-field views-field-title views-field-body">
    <a href="/node/470" hreflang="en" data-once="views-ajax">Test with comments</a>
    <p>Body text here with <strong>some HTML</strong>.</p>
    <a href="/node/470/edit?destination=/admin/structure/views/view/duplicate_of_manage_corporate_active_requests/preview/page_1%3F_wrapper_format%3Ddrupal_ajax" hreflang="en" data-once="views-ajax">edit</a>
    </td>

    Fields displayed in separate columns:

    <td headers="view-title-table-column--N3fpHc6FMWU" class="views-field views-field-title">
    <a href="/node/470" hreflang="en" data-once="views-ajax">Test with comments</a>
     </td>
    <td headers="view-body-table-column--Dxql8bimhMU" class="views-field views-field-body">
    <p>Body text here with <strong>some HTML</strong>.</p>
    </td>
    <td headers="view-edit-node-table-column--8z0MW96QIvM" class="views-field views-field-edit-node">
    <a href="/node/469/edit?destination=/admin/structure/views/view/duplicate_of_manage_corporate_active_requests/preview/page_1%3F_wrapper_format%3Ddrupal_ajax" hreflang="en" data-once="views-ajax">edit</a>
    </td>

    If the OP or anyone else has info on how to reproduce, please update the issue summary with specific steps. If that is not provided, this issue may be closed after 3 months.

  • Status changed to Closed: cannot reproduce 6 months ago
  • πŸ‡³πŸ‡ΏNew Zealand luke.stewart

    Nine months has lapsed.

    No update since then.

    Closing.

  • πŸ‡«πŸ‡·France erwangel

    Set following fields:
    - "Content: Image"
    - "Content: Authored by" [hidden] and in "Style settings" Customize field HTML "EM"
    - "Content: Authored on" with "Rewrite results" {{ uid }} - {{ created }} Already here "Authored on" lost its EM while "Strip HTML tags" is "off"
    - "Content: Title" and in "Style settings" Customize field HTML "H3"
    All fields have "Add default classes" in "Style settings"

    Format as table with:
    Content: Image in column Content: Image
    Content: Authored on in column Content: Title
    Content: Title in column Content: Title

    Results to a <td> where: "Authored by" loses its "EM" tag and the rewritten "Authored on" is wrapped in the Title's H3!
    <h3>Author's name - Date <a href="article link">Title</h3>
    Even if we wrap "Authored on" in a div it remains inside the title's H3
    - Content: Authored on with "Rewrite results" <div><em>{{ uid }}</em> - {{ created }}</div>
    Result: <h3><div><em>{{ uid }}</em> - {{ created }}</div> <a href="article link">Title</h3>

    The only way to overcome is to manually group and format everything in title's "Rewrite results"
    <div><em>{{ uid }}</em> - {{ created }}</div><h3>Title<h3>

    So I see two problems: one with rewriting, where customized html tag is lost, and the second with table format where grouping fields in a column strips previous html and wraps fields in the last field's tagging.
    Anyway one would expect that each field preserves its own html tagging ans style settings unless it is specified to "Strip HTML tags".

Production build 0.71.5 2024