1

data-label="{table:column_name}" and scope="col" disappears when loaded into template.

{table:table cellspacing="0" cellpadding="0"}
<table>
  <thead>
    <tr>
      <th scope="col">{table:column_name}</th>
      <th scope="col">{table:column_name}</th>
      <th scope="col">{table:column_name}</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td data-label="{table:column_name}">{table:grid_field_1}</td>
      <td data-label="{table:column_name}">{table:grid_field_2}</td>
      <td data-label="{table:column_name}">{table:grid_field_3}</td>
    </tr>
  </tbody>
</table>
{/table:table}
2

The Grid field's :table modifier is actually just a single tag, not a tag pair.

{table:table cellspacing="0" cellpadding="0" class="my-table"}

That variable by itself will output the entire table including all variables; it's just a shortcut for those who don't want to customize or write their own table markup. See the :table modifer docs for details.

You should be able to build your table with whatever markup you need using the regular Grid variable pair, however. E.g.:

<table>
    <thead>
        <tr>
            <th scope="col">Foo</th>
            <th scope="col">Bar</th>
        </tr>
    </thead>
    <tbody>

    {table}
        <tr>
          <td data-label="Foo">{table:foo}</td>
          <td data-label="Bar">{table:bar}</td>
        </tr>
    {/table}

    </tbody>
</table>
1
  • Perfect, worked out great! Thanks again Derek. Oct 31 '17 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.