Genie Discord forum

Author AvatarMordegai
7/13/2023, 8:06:07 AM

I want to display data from a DataFrame in a DataTable. I looked at the Iris example app and it seems like I'm doing things correctly but I'm not getting any data being displayed.


using GenieFramework using Dates using DataFrames using .Overshoot @genietools

function filter_df() df = create_df() df =, , , , , ) rename(df, => ) rename(df, => :"Overshoot date") rename(df, => ) rename(df, => :"Overshoot days") rename(df, => :"Cumulative overshoot days")

return df


@app begin @in consumption_date = today()

@out consumed_on = string(calculate_used_date(today()))
@out consuming = string(calculate_using_date(today()))

@in day_weights = PlotData[PlotData(x = create_df().year, y = create_df().rounded_weight)]
@in overshoot_days = PlotData(x = create_df().year, y = create_df().rounded_overshoot_days)
@in cumulative_overshoot_days = PlotData(x = create_df().year, y = create_df().rounded_cumulative_overshoot_days)

@in data = DataTable(filter_df())

@onchange consumption_date begin
    # consumed_on = string(calculate_used_date(consumption_date))
    # consuming = string(calculate_using_date(consumption_date))


@page("/", "app.jl.html") end

Author AvatarPere
7/13/2023, 9:15:44 AM

The Julia code looks fine, excet that dataperhaps should be @in. Can you share the HTML for the table component too? Here's a MWE with a table if it helps

Author AvatarMordegai
7/13/2023, 9:23:41 AM

Could it be because I did not define columns? I assumed it would extract the column names from the DataFrame.

Author AvatarMordegai
7/13/2023, 9:27:57 AM

Changed it to this: and now it works. Seems like the nocode editor generates the html wrong.

Author AvatarMordegai
7/13/2023, 9:28:32 AM

Also renamed data to table ๐Ÿ˜‰

Author AvatarPere
7/13/2023, 9:29:35 AM

๐Ÿคฆโ€โ™‚๏ธ ouch yea, we have a patch ready to fix this HTML tag. The columns parameter is not needed, but if you don't have it the columns will be in random order. also, as you already saw, you need to use the .data field in the DataTable object

Author AvatarMordegai
7/13/2023, 9:32:06 AM

Thanks! Starting to get the hang of it ๐Ÿ˜‰