@shane wrote:
I’ve searched around the forums and it appears like my callback setup is correct but I can’t update the options of a checklist.
I’ve confirmed that if I manual use parse_names(df) upon app execution that the checklist options appear. So I’m pretty confident in the return value to variableList (checklist2). Just to be sure I printed out the return value. Here’s part of it:
parsed = [{‘label’: ‘Device restarted’, ‘value’: 1}, {‘label’: ‘Device returned’, ‘value’: 2}, {‘label’: ‘Restraint Switch SW1’, ‘value’: 3}, {‘label’: ‘Restraint Switch SW2’, ‘value’: 4}, {‘label’: ‘Approach Vu Input’, ‘value’: 5},…}]Links I’ve used:
https://dash.plot.ly/getting-started-part-2
https://dash.plot.ly/dash-core-components/checklist
https://dash.plot.ly/interactive-graphingMy checklist: checklist2 = dcc.Checklist( id = 'variableList', style = {'overflow': 'auto','height': 400}) My app.layout app.layout = html.Div([ html.Img(src='data:image/png;base64,{}'.format(encoded_image2.decode()), width = 200), html.Div([ html.Div([ html.H3('Import Options', style={'text-align': 'center'}), html.Div([ btn1, html.H3('Docks'), checklist1, html.H3('Variables'), checklist2], style = {'overflow':'auto','height': '80vh'})], className="one-third column" ), html.Div([ html.H3('Visualization', style={'text-align': 'center'}), ph1, dcc.RangeSlider( id='non-linear-range-slider', marks={i: '{}'.format(10 ** i) for i in range(4)}, max=3, value=[0.1, 2], dots=False, step=0.01, updatemode='drag'), html.Div(id='output-container-range-slider-non-linear', style={'margin-top': 20}), btn2, html.Img(src='data:image/png;base64,{}'.format(encoded_image1.decode()), width = 200)], className="eight columns")], className="two rows")]) My button1 callback: @app.callback(Output('variableList','options'), [Input('btn-1', 'n_clicks')]) def button1(value): if value == 0: return else: ssh_client = paramiko.SSHClient() #create SSH client ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh_client.connect('xxxxxxxx', username='xxxxxxx', password='xxxxx') #connect to server lstBuff = dbf.sendCommand(command, ssh_client) df = dbf.processMessage(lstBuff) ssh_client.close() #close the ssh portal parsed = parse_names(df) return parsed
Posts: 2
Participants: 2