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

Advanced checklist #209

Open
renatobellotti opened this issue Jun 17, 2023 · 1 comment
Open

Advanced checklist #209

renatobellotti opened this issue Jun 17, 2023 · 1 comment

Comments

@renatobellotti
Copy link

Hello,

The following snippet works in Python:

from dash import Dash, dcc, html


entries = [
    {
        "label": [
            html.Div(style={
                "width" : "2cm",
                "height": "1em",
                "background-color": "red",
            }),
            "my test",
        ],
        "value": "my test",
    },
]

structure_checkboxes = dcc.Checklist(options=entries, style={
    "width": "100%",
})

app = Dash()

structure_list = html.Div(className="col-6", children=[structure_checkboxes])
gui = html.Div(children=[structure_list])

app.layout = html.Div(gui)

if __name__ == '__main__':
    app.run_server(debug=True)

I have tried this simplified code, but even the simplified example gives me the following error message:

Invalid argument `options[0].label` passed into Checklist.
using Dash


entries = [
    Dict(
        "label" => ["my test"],
        "value" => "my test",
    ),
]


structure_checkboxes = dcc_checklist(options=entries)


app = dash()

structure_list = html_div(
    className="col-2",
    children=[structure_checkboxes],
)

gui = html_div(children=[structure_list])


 app.layout = html_div() do
    gui
end

run_server(app, "0.0.0.0", 8080, debug=true)

How would I translate this to Julia? Unfortunately, the corresponding section in the documentation is not translated to Julia.

@etpinard
Copy link
Collaborator

Thanks for posting!

Updating the JS deps (as in #208) will get us most of the way there.

Using the #208 branch, I got your Julia snippet to run

image

We can translate the original python snippet into:

using Dash

entries = [Dict("label" => [html_div(; style=Dict("width" => "2cm",
                                                  "height" => "1em",
                                                  "background-color" => "red")),
                            "my test"],
                "value" => "my test")]

structure_checkboxes = dcc_checklist(options=entries, style=Dict("width" =>"100%"))

app = dash()

structure_list = html_div( className="col-6", children=[structure_checkboxes])
gui = html_div(children=[structure_list])

app.layout = html_div(gui)

run_server(app, "0.0.0.0", 8080, debug=true)

but unfortunately even using the branch from #208, I'm getting

image

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