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:
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