basically I want to be able to create a new set of checkboxes based on a previous set. This is to give user flexibility in moving back and forth. I basically create a set of checkboxes based on selection from (checklist). Then I want to create another set based on the deselection of the new. But I am not able to use the State function for checklist 2?
@app.callback(Output(‘ch1’, ‘children’),
[Input(‘button1’,‘n_clicks’)],
[State(‘checklist’,‘values’)])
def update_output(clicks, val):
if clicks > -1:
for q in val:
if q not in selq:
selq.append(q)
return(dcc.Checklist(
id = 'checklist2',
options= [
{'label': Q, 'value': Q} for Q in selq
],
values=0
))
@app.callback(Output(‘ch2’, ‘children’),
[Input(‘button3’,‘n_clicks’)],
[State(‘checklist2’,‘values’)])
def new1(abc,val2):
if abc>-1:
for a in val2:
if a not in selq1:
selq1.append(a)
return(dcc.Checklist(
id = ‘checklist3’,
options= [
{‘label’: A, ‘value’: A} for A in selq1
],
values=0
))