I was wondering if there are packages that can create an interactive .html table, to be included in a Quarto document?
In R, there is DT, which outputs basically JS-code for interactive tables in the html.
It should be possible with PlotlyJS.jl
1 Like
The only other pure Julia option beside’s @langestefan’s suggestion for PlotlyJS tables is Dash, but it’s sort of a kludge to use with Quarto through an <iframe>
using Dash, DataFrames
app = dash()
df = DataFrame(
name = ["Alice", "Bob", "Charlie"],
age = [25, 30, 35],
city = ["Seattle", "NYC", "LA"]
)
data = [Dict(names(df) .=> collect(row)) for row in eachrow(df)]
app.layout = html_div() do
dash_datatable(
id="table",
columns=[Dict("name" => i, "id" => i) for i in names(df)],
data=[Dict(names(df) .=> collect(row)) for row in eachrow(df)],
sort_action="native",
filter_action="native",
page_size=10,
style_cell=Dict("textAlign" => "left")
)
end
run_server(app, "0.0.0.0", 8050)
2 Likes
Thank you, @langestefan and @technocrat!
The PlotlyJS is only providing a picture, while I was thinking about interactivity such as filtering or ordering by column, which is exactly what Dash provides ![]()
I’ve been actually looking at that, but didn’t know how to use it in Julia - thank you @technocrat for the example code!
1 Like
The PlotlyJS.jl tables also have interactivity, but it seems somewhat limited in what it can do. I looked at the plotly.js javascript examples, and they are also quite limited: Tables in JavaScript