After putting the ID and auto filling the Product, need to do a callback to fill a df with the ID, Product, Value and Date
Can someone help me make this callback?
I assume you want to send the user inputs to an external object (such as a pandas dataframe).
In this case, you will have a callback with 1 Input of the submit button clicks, 4 States (filled ID, Product, Value, Date) but nothing to Output. However, Dash requires to have at least one Output.
A trick is to add an empty html.Div() in your app, and set it as the Output. You can set the style of the div as hidden so that people won’t notice.
@app.callback([Output('hidden-div', 'children')], [Input( ... )], [State( ... )])
def submit_form(submit, id, product, value, date):
# fill in a df
df = add_row_to_df(df, id, product, value, date)
return