hello,
i would like ask a question and i need your encouregement.
with callback function, my intention is getting the value of dropdown and show it as a checklist, then i added html button for clear the created html.Div with checklist.
@app.callback(
Output('leftSideDropdown', 'children'),
Input('stockselector', 'value'),
State('leftSideDropdown', 'children'),
def display_dropdowns(value, children):
new_checklist = dcc.Checklist(
id='drop_check_left',
options=[{'label': i, 'value': i} for i in [value]],
style = {'color' : "white", 'fontFamily' : 'Arial', 'fontSize' : '1.2rem',
'cursor':'pointer'}
)
if value !='':
children.append(html.Div([html.Div(html.Div(new_checklist),className = 'checklist_design'),
html.Div(html.Button('Clear', id = 'clearing'), className = 'buttons')], className = 'stockSelectorClass')
)
return children
else : return children
in this example, i created a checklist and button within the children, and when i presse this created clear button i cannot clear it with this method.
def clear_checklist(n_click):
changed_id = [p['prop_id'] for p in dash.callback_context.triggered][0]
if 'clearing' in changed_id:
return []
when i added a html Div with checklist and button, i think every div creates same “id”, that is right? and how can i solve this problem.
Thank You
1 post - 1 participant





