My question is simple but I'm a beginner in Dash and UI development.
I create a Form like the below code: I have a dropdown with two values ( Node and Edge), a "+" button, and a textarea. A user wants to select a value from the dropdown then click the + button. The selected value must add to the textarea. If the user clicks to + button again, the value must add again. My code update the value in the textarea ad doesn't add the elected values again. What's wrong with my code?
import dash_bootstrap_components as dbc
import dash_core_components as dcc
fLayout = dbc.FormGroup([
dbc.Form([
dcc.Dropdown(options=[{'label':'Node','value':'Node'},{'label':'Edge','value':'Edge'}],id='fcolumns'),
dbc.Button ('+',id='fcol_btn')
],inline=True),
dbc.Form([
dbc.Button(['='],id='fequal'),
dbc.Button (['>'],id='fgt')
],inline=True),
dbc.Form([
dbc.Textarea(id='ftxt'),
dbc.Button (['ok'],id='ftxt_btn')
],inline=True)
])
@app.callback(
Output("ftxt", "value"),
[Input("fcol_btn", "n_clicks"), Input("fequal", "n_clicks"),Input("fgt", "n_clicks")],
[State("fcolumns", "value")],
)
def filter_update(fcol_btn, fequal, fgt,fcolumns):
if fcol_btn>0:
return fcolumns
if fequal >0:
return "="
if fgt >0:
return ">"