Skip to content

TBODY should be a FlowContent #284

@reubenfirmin

Description

@reubenfirmin

For the same reason as #283, TBODY should be a FlowContent. The strict typing makes it hard to flexibly generate fragments. HTMX style pages are where this framework really shines - but the typing makes it difficult.

Consider:

I have a data table component. My tbody is:

            tbody {
                id = tableTarget.id
                renderRows([email protected], [email protected], [email protected])
            }

When I call my data table component, I want it to either generate additional rows (using all of the same configs) or generate the full table.

fun <T, R> FlowContent.datatable(classes: String,
                                 records: List<TableRecord<T, R>>,
                                 configs: List<FieldConfiguration<T, R>>,
                                 headingRenderers: List<FieldHeadingConfiguration>? = null,
                                 loadNextPage: BaseRoute? = null,
                                 rowsOnly: Boolean = false,
                                 rowStyle: String = DEFAULT_ROW_STYLE) {
    if (rowsOnly) {
        renderRows(records, rowStyle, configs)
    } else {
        Datatable(classes, records, configs, headingRenderers, rowStyle, loadNextPage, consumer).visit {
            render()
        }
    }
}

What receiver works for renderRows in both cases? Nada. It's inconvenient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions