Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TBODY should be a FlowContent #284

Open
reubenfirmin opened this issue Jun 14, 2024 · 0 comments
Open

TBODY should be a FlowContent #284

reubenfirmin opened this issue Jun 14, 2024 · 0 comments

Comments

@reubenfirmin
Copy link

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(this@Datatable.records, this@Datatable.rowStyle, this@Datatable.configs)
            }

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant