Plugin screenshot thumbnail 1/1

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.

Table Maker

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
Version
4.0.4
License
MIT
Compatibility
Craft 3, Craft 4
Last release
February 22, 2023
Categories
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs