HTML Table in Structured Text

Is it possible to use HTML table within structured text?

1 Like

Hello @tarek

No, it is currently not possible to do it directly in the structured text. But you can do it in a multi-paragraph field with presentation set to HTML editor

If you want, you can create a block with a multi-paragraph HTML editor, and then you can use that block inside a structured text:

Hope this helps!

1 Like

Are there any plans for a beter headless table format?

HTML is not an option in some cases

Hello @K-user

What do you mean by a headless solution? Could you exemplify what the API response for a more headless table solution could be instead of the HTML structure?

Let us know!

I may not have the overview to see the complexity that you can see but I was thinking about a JSON object that contains the table heading and body.

It could be a simple array of arrays:

{
    "heading": [
        "column1 title",
        "column2 title"
    ],
    "body": [
        [
            "row 1 column1",
            "row 1 column2"
        ],
        [
            "row 2 column1",
            "row 2 column2"
        ]
    ]
}

Or if there need to be more info for each row / column an array of objects

{
    "heading": [
        {
            "text": "column1 title"
        },
        {
            "text": "column2 title"
        }
    ],
    "body": [
        {
            "items": [
                {
                    "text": "row 1 column1"
                },
                {
                    "text": "row 1 column2"
                }
            ]
        },
        {
            "items": [
                {
                    "text": "row 2 column1"
                },
                {
                    "text": "row 2 column2"
                }
            ]
        }
    ]
}

@K-user Thank you for the clarification!

In that case i think this plugin right here: Table Editor - Plugins - DatoCMS
Is exactly what you are looking for :slight_smile:

1 Like

That plugin is perfect. Im curiouse why it is no integrated functionality, expecially since the plugin isn’t third-party made but by Stefano?

Also if im not mistaken, this plugin is fairly new (two months old). I did not see this plugin/functionality comeup in the product change logs / updates. I would think that you guys are eager to add great functionality like this and notify all users thru the changelogs / product updates?

Anyways thanks for pointing out this plugin!

Thats great!

It is not integrated natively because we’re trying to keep the amount of native options to the absolute necessary to keep the UI simple and intuitive, and delegate the more complex customisation options and specific use-cases to optional plugins

We do blog posts to announce some of the new plugins, like this one: Plugins Roundup: What's possible with the new SDK - DatoCMS and only put the major native changes on the change-log, not to spam the users with notifications

Allright thx for clarifying.

I would love if this could turn into a feature request. I think a table editor is generally something that most people would need in a rich text editor. Especially one that can take advantage of the other features of the editor, like bold, italic, headings, etc. Any chance we can make this a feature request?

1 Like

sure, I’m converting it :slight_smile: