Skip to content

Array of DataTable is rendered different than DataTable #133

Description

@PGimenez

Rendering an array of DataTable changes the dict content and adds extra fields. This is a problem when running a v-for loop to show multiple tables.

MWE:

using GenieFramework
@genietools

@app begin
    @out table = DataTable()
    @out tablearray = [DataTable(), DataTable()]
end

ui() = "{{table}}<br>{{tablearray}}"

@page("/", ui)

What the page shows:

{ "data": [], "columns": [] } 

[ { "data": { "columns": [], "colindex": { "lookup": {}, "names": [] }, "metadata": null, "colmetadata": null, "allnotemetadata": true }, "opts": { "addid": false, "idcolumn": "ID", "columns": null, "columnspecs": {} } }, { "data": { "columns": [], "colindex": { "lookup": {}, "names": [] }, "metadata": null, "colmetadata": null, "allnotemetadata": true }, "opts": { "addid": false, "idcolumn": "ID", "columns": null, "columnspecs": {} } } ]

This can be solved with a specific renderer:

function Stipple.render(tables::Vector{T}) where {T<:DataTable}
  [StippleUI.Tables.data(t)  for t in tables]
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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