Quantcast
Channel: ЁЯОЫя╕П Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271
тЖз

Checklist button doesn't select other checklist buttons properly on calling callbacks

$
0
0

I am trying to select multiple checklist buttons based on other single checklist button by using callback but it is not selecting after I deselect and reselect that particular button.
Here is the attached gif:
www_screencapture_com_2021-1-14_17_53

Here is the relevant code:

html.Div(
                        [
                            dbc.FormGroup(
                                [
                                    dbc.Label(
                                        "ЁЯМ┤ Filter by Preprocessing Functions to Apply:"
                                    ),
                                    dbc.Checklist(
                                        options=[
                                            {"label": "All", "value": "all"},
                                            {"label": "Customized", "value": "custom"},
                                        ],
                                        value="all",
                                        id="radio-button",
                                        inline=True,
                                        style={"padding": "10px"},
                                    ),
                                ]
                            ),
                            html.Div(
                                [
                                    dbc.FormGroup(
                                        [
                                            dbc.Checklist(
                                                id="checklist-button",
                                                options=[
                                                    {
                                                        "label": "remove_digitsЁЯФв",
                                                        "value": "remove_digits",
                                                    },
                                                    {
                                                        "label": "remove_accented_chars (├С)",
                                                        "value": "accented_char_removal",
                                                    },
                                                    {
                                                        "label": "lemmatize_the_text",
                                                        "value": "lemmatize_the_text",
                                                    },
                                                    {
                                                        "label": "remove_stopwords",
                                                        "value": "stop_words",
                                                    },
                                                ],
                                                value=[
                                                    "remove_digits",
                                                    "accented_char_removal",
                                                    "lemmatize_the_text",
                                                    "stop_words",
                                                ],
                                                switch=True,
                                            )
                                        ]
                                    )
                                ],
                                style={"padding": "5px", "margin-bottom": "10px",},
                            )

Callback for connecting both checklist:

@app.callback(Output("checklist-button", "value"), [Input("radio-button", "value")])
def display_status(selector):
    if selector == "all":
        return [
            "remove_digits",
            "lemmatize_the_text",
            "stop_words",
            "accented_char_removal",
        ]
    else:
        return []

I want if All button is selected any number of times after deselecting, the below all checklist buttons should be selected and if customized button is selected then none of the below buttons should be selected at first and user can select any particular buttons from below.

3 posts - 2 participants

Read full topic

тЖз

Viewing all articles
Browse latest Browse all 6271

Trending Articles