exetico
exetico

Reputation: 177

Use HTML Table without headers

I've a table, where the normal guidance for HTML tables arn't followed.

My best move will be, to just create a proper JSON-object, and using that.

But i'll like to ask, if there is any options for parsing an HTML table, "without headers", and define them in Tabulator, instead.

I know the case id odd, but i'll just like to hear :-)

Example where no thead and th is in the HTML-source:

<table border="0" cellpadding="0" cellspacing="0">
    <tbody>
        <tr height="16">
            <td colspan="16">
                Something
            </td>
            <td colspan="16">
                14
            </td>
            <td colspan="16">
                2020-01-28
            </td>
        </tr>
    </tbody>
</table>

Upvotes: 1

Views: 12198

Answers (2)

Tufy Duck
Tufy Duck

Reputation: 110

I solve problem like this

    <table border="0" cellpadding="0" cellspacing="0">
            <tr height="16" hidden>
                <td colspan="16">
                </td>
                <td colspan="16">
                </td>
                <td colspan="16">
                </td>
            </tr>
            <tr height="16">
                <td colspan="16">
                    Something
                </td>
                <td colspan="16">
                    14
                </td>
                <td colspan="16">
                    2020-01-28
                </td>
            </tr>
    </table>

Upvotes: 1

Oli Folkerd
Oli Folkerd

Reputation: 8358

Im afraid not.

When Tabulator is built on a table element, it parses the HTML to create a JavaScript object for each row of the table, using the column headers as property names.

Without headers it would have no reasonable way to map the column values onto an object.

Upvotes: 1

Related Questions