Hello,
In the following code, I have a callback that hide/show a manu by a button. The problem is that every time the menu is hidden, the triggered options resets.
Is there any way to maintain the triggered options when the menu hides?
@app.callback(
Output('options', 'children'),
[Input('hamburguer', 'n_clicks')])
def options_tab(hamburguer):
if hamburguer == None:
display = style={'display' : 'none'}
elif (hamburguer % 2) == 0:
display = style={'display' : 'none'}
else:
display = None
return html.Div(className='sidebar',children=[
html.Div(
id='project_name',
style={
'margin-top' : '0px',
'color': 'rgb(241,90,90)',
'text-align' : 'center',
'text-transform': 'uppercase',
'font-size' : '1.75rem',
'vertical-align' : 'middle',
}),
html.Hr(className='hr'),
html.Hr(className='hr'),
html.Div(className='daq_div row', children=[
html.Div(className='daq_title columns', children=[
'Transmission'
]),
html.Div(className='daq_1 columns', children=[
html.Div(className='daq_2 columns', children=[
daq.ToggleSwitch(
id='rt_switch',
value=False,
size=20,
color='rgb(241,90,90)'
),
])
])
]),
html.Hr(className='hr'),
html.Hr(className='hr'),
html.P('Map Style', className='titles'),
dcc.RadioItems(
className='radio',
id='map_options',
options=[
{'label': 'City', 'value': google},
{'label': 'Satelite', 'value': satelital},
{'label': 'Dark', 'value': dark}
],
value = google,
labelStyle={'color': '#2c2c2c'}
),
html.Hr(className='hr'),
html.Hr(className='hr'),
html.Div(className='daq_div row', children=[
html.Div(className='daq_title columns', children=[
'Free Zoom'
]),
html.Div(className='daq_1 columns', children=[
html.Div(className='daq_2 columns', children=[
daq.ToggleSwitch(
id='zoom_switch',
value=False,
size=20,
color='rgb(241,90,90)'
),
])
])
]),
html.Hr(className='hr'),
html.Hr(className='hr'),
html.P('Trace', className='titles'),
dcc.RadioItems(
className='radio',
id='trace_options',
options=[
{'label': 'Dots', 'value': 'markers'},
{'label': 'Lines', 'value': 'lines'}
],
value = 'lines',
labelStyle={'color': '#2c2c2c'}
),
html.Hr(className='hr'),
html.Hr(className='hr'),
html.Div(className='daq_div row', children=[
html.Div(className='daq_title columns', children=[
'Navigator'
]),
html.Div(className='daq_1 columns', children=[
html.Div(className='daq_2 columns', children=[
daq.ToggleSwitch(
id='nav',
value=False,
size=20,
color='rgb(241,90,90)'
),
])
])
]),
],style = display)
1 post - 1 participant