and this is my code
import dash
from dash.dependencies import Input, Output
import dash_table
import dash_core_components as dcc
import dash_html_components as html
from myPandas import site_code_col, exting_sites, ext_sites
app = dash.Dash(__name__)
app.layout = html.Div([
dcc.Markdown('''
>** From PP to Optimization**
'''),
# html.Label('From PP to Optimization'),
dcc.Checklist(
options=[
{'label': 'From HU PP to HU Opt.', 'value': 'HPPO'}
],
labelStyle={
'display': 'inline-block',
'margin-right': 50
},
id='frmHPPTHOpt'
),
dcc.Markdown('''
** Choose Sites which depends on PP(Review PP Report (FirstTime))**
'''),
dcc.Checklist(
options=[
{'label': 'Review PP Report (FirstTime)', 'value': 'RPRFT', 'disabled': True},
],
id='rvpprptft'
),
# html.Label('Choose Sites which depends on PP(Review PP Report (FirstTime))'),
dcc.Dropdown(
id="scRPRFT",
options=[{'label': i['site_code'], 'value': i['site_code']} for i in site_code_col],
placeholder="Select a SiteCode",
multi=True,
disabled=True
# value="MTL"
),
dcc.Markdown('''
** Choose Sites which depends on PP(Review PP Report (Rectified from TE Plan))**
'''),
dcc.Checklist(
options=[
{'label': 'Review PP Report (Rectified from TE Plan)', 'value': 'RPRRTP', 'disabled': True},
],
),
# html.Label('Choose Sites which depends on PP(Review PP Report (Rectified from TE Plan))'),
dcc.Dropdown(
id="scRPRRTP",
options=[{'label': i['site_code'], 'value': i['site_code']} for i in site_code_col],
placeholder="Select a SiteCode",
multi=True,
disabled=True
# value="MTL"
),
dcc.Markdown('''
** Choose Sites which depends on PP(Review PP Report (Rectified from TE Opt.))**
'''),
dcc.Checklist(
options=[
{'label': 'Review PP Report (Rectified from TE Opt.)', 'value': 'RPRTO', 'disabled': True},
],
),
# html.Label('Choose Sites which depends on PP(Review PP Report (Rectified from TE Opt.))'),
dcc.Dropdown(
id="scRPRRTO",
options=[{'label': i['site_code'], 'value': i['site_code']} for i in site_code_col],
placeholder="Select a SiteCode",
multi=True,
disabled=True
# value="MTL"
),
dcc.Markdown('''
** Choose Sites which depends on PP(Review PP Report (Rectified from TE Opt. & Plan)))**
'''),
# html.Label('Choose Sites which depends on PP(Review PP Report (Rectified from TE Opt. & Plan))'),
dcc.Checklist(
options=[
{'label': 'Review PP Report (Rectified from TE Opt. & Plan)', 'value': 'RPRRTOP', 'disabled': True},
],
),
dcc.Dropdown(
id="scRPRRTOP",
options=[{'label': i['site_code'], 'value': i['site_code']} for i in site_code_col],
placeholder="Select a SiteCode",
multi=True,
disabled=True
# value="MTL"
),
html.Button('Submit', id='button'),
html.Div(id='datatable-row-ids-container')
])
if __name__ == '__main__':
app.run_server(debug=True)
Now All I need when I click the checkbox
with this id='rvpprptft'
, Just make the other the Dropdown
enable
#Edited
I tried Something like this but it doesn’t work
…
@app.callback(
Output('scRPRFT', 'options'),
[Input('rvpprptft', 'value')])
def set_PP_HUOpt_cb_enable(hu_pp_opt_checked_list):
return [{'disabled':False, 'value': i} for i in ext_sites[hu_pp_opt_checked_list]]
and this error I found
Callback error updating scRPRFT.options
and I tired this also
@app.callback(
Output('scRPRFT', disabled=False),
[Input('rvpprptft', 'value')])
def set_PP_HUOpt_cb_enable(hu_pp_opt_checked_list):
return [{'disabled':False, 'value': i} for i in ext_sites[hu_pp_opt_checked_list]]
and this is error I found
Traceback (most recent call last):
File "C:/Users/DELL/PycharmProjects/Gov-Trac-Tool/jhfjfgh.py", line 167, in <module>
Output('scRPRFT', disabled=False),
TypeError: __init__() got an unexpected keyword argument 'disabled'
#Edited 2
I tried some thing like this
@app.callback(
Output('scRPRFT', 'disabled'),
[Input('rvpprptft', 'value')])
def set_PP_HUOpt_cb_enable():
return [{'disabled':False}]
and this is the error for the previous part
Callback error updating scRPRFT.disabled
but it doesn’t work also
I tried this also find the same error
@app.callback(
Output('scRPRFT', 'disabled'),
[Input('rvpprptft', 'value')])
def set_PP_HUOpt_cb_enable():
return dcc.Dropdown(disabled=False)
this is the last updated code
any one have any idea for the right syntax to do this?