Hi there,
I’m simply trying to display a table on my dashboard, thank to DashTable.
But yet it doesn’t seem really adapted to Julia.
Could someone enlight me on this point?
df = DataFrame(A =["Sunny", "Snowy"],
B= [13, 43])
app = dash_datatable()
app.layout = html_div() do
html_div(
dash_datatable(
id="ccc",
name = ???)
end
Many thanks
https://juliahub.com/docs/DashTable/OyY8N/4.10.1/autodocs/
Hello and welcome!
The Docstrings can be a bit tricky to understand, but most of the functionality mimics the Python version:
`dash_table.DataTable` is an interactive table that supports rich styling, conditional formatting, editing, sorting, filtering, and more.
html_div(id="table1", style=(width=default_width,backgroundColor="#dbe4f0 ", border="4px solid LightSteelBlue",hidden=false),
DashTable.dash_datatable(id="table", editable=true,
columns = [(name="fruits", id="fruits"),(name="vegetables", id="vegetables")],
data = [
Dict("fruits" => "apple", "vegetables" => "tomato"),
Dict("fruits" => "orange", "vegetables" => "onion")
],
style_cell = (textAlign="center",fontSize=16)
)),
Notice how the data Dicts entries must have the same name as the header columns names.
Many thanks your answer, it works correctly!
I’m now stuck trying to give a title tot this datatable. Digging in the doc but nothing about this point
You could simply make a header on top. Something like:
html_h1("Table title", style=(textAlign = "left", fontSize=20))
I think you can also trick it by using multiple headers:
`dash_table.DataTable` is an interactive table that supports rich styling, conditional formatting, editing, sorting, filtering, and more.
Just what I was going to write!
1 Like
As you seem to be connected, any idea of why style_cell is not taking account of my arguments?
But it’s work correctly when there is only one argument
html_div(id="table2", style=(backgroundColor="#dbe4f0 ", border="4px solid LightSteelBlue",hidden=false,width = "20%",display = "inline-block",autosize = true, margin = "1em"),
dash_datatable(
id="mkt",
columns = [Dict("name" => "A", "id"=> "first"),Dict("name"=>"B", "id"=>"second")],
data = dh,
style_cell = ("textAlign" => "center","fontSize" => 16)
))
I updated my example. You need to either use dictionaries or named tuples(my example uses named tuples for style). In your case you supplied a “pair”: this is a component of a Dict, but not the Dict itself.