Craft Tablecloth
  • What is Tablecloth?
  • Installation
  • Table Definition
    • Data Source
    • Columns
    • Options
    • General Settings
    • Advanced
  • Table Rendering
    • Default Table
    • Templates
      • Table Templates
        • Cards Layout Example
      • Field Type Templates
      • Specific Field Templates
      • Child Rows
  • Programmatic Interaction
    • Interacting with The Table
    • Events
    • Methods
  • Localization
  • Contact Us
Powered by GitBook
On this page
  1. Table Rendering

Default Table

PreviousAdvancedNextTemplates

Last updated 3 years ago

We are now ready to render the table, and it's a cinch!

Go to the twig file where you would like to embed the table and add the following line at the very beginning:

{% do view.registerAssetBundle('matfish\\Tablecloth\\TableclothAssetBundle') %}    

This will import the required assets:

  • AlpineJS v3.7.1

  • Tablecloth JavaScript file

  • Tablecloth CSS file

Now, all that's left is to embed the table wherever it should go in your page. You can have multiple tables on the same page. Assuming the table handle is posts (see page) we will render it like so:

{{ tablecloth('posts') | raw }}

Load the page in the browser to see the result:

Data Source