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

Array of DataTable is rendered different than DataTable #133

Open
PGimenez opened this issue Aug 20, 2024 · 1 comment
Open

Array of DataTable is rendered different than DataTable #133

PGimenez opened this issue Aug 20, 2024 · 1 comment

Comments

@PGimenez
Copy link
Member

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
@hhaensel
Copy link
Member

Even better

Stipple.render(tables::Vector{<:DataTable}) = render.(tables)

I shall add that to Tables.

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

2 participants