We've recently acquired this from the Supercool team. Read our blog post for more details.
Let your users define their own table columns in your Craft control panel.
Usage
There are two ways you can go about templating a table: use the built-in html output or access the column and row data directly to code your own.
Automatic table output
This will simply output a valid html table:
{{ entry.myTableField.table }}
Code your own
Should you want more control over the output you can just access the column and row data directly instead using {{ entry.myTableField.columns }}
and {{ entry.myTableField.rows }}
.
Here is an example of how you might do just that:
<table>
<thead>
<tr>
{% for col in entry.myTableField.columns %}
<th align="{{ col.align }}" width="{{ col.width }}">{{ col.heading }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in entry.myTableField.rows %}
<tr>
{% for cell in row %}
<td align="{{ entry.myTableField.columns[loop.index0].align }}">{{ cell }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
Note that when looping rows you can use the current loop index to find the appropriate alignment value for that column.
- Installation Instructions
To install this plugin, copy the command above to your terminal.
- Active Installs
- 3,667
- License
- MIT
- Last release
- February 22, 2023
- Activity (30 days)
- 0Closed Issues0Open Issues0Merged PRs0Open PRs