First of all a big thanks to everyone at Plotly and the community for an excellent product and information/resources available!
I am working on an app that takes a list of system and their names and lists these as “blocks” in a grid. When a “block” is clicked some actions (filtering of a table, communicating with an API, etc.) should be executed through a callback with other_info
. Initially, I tried to implement this based on the “Event”-functionality, but as this has been removed I am now working with “Input”.
Currently, I am experiencing two challenges:
1. The dynamically defined callback appears to pass one variable per “block” to the function to be executed (i.e. way more inputs than the function is expecting). As the “blocks” are dynamically defined it is no possible to “hard code” these as inputs to the function.
2. Using n_clicks
necessitates keeping track of clicks on each “block” to be able to figure out which block was clicked most recently. Is there another way of handling this?
The current callback is as follows.
@app.callback(
Output('overview-table', 'children'),
[Input( 'sys_number_{}'.format(sys_info.sys_number), 'n_clicks') for i, sys_info in system_df.iterrows()],
)
def update_table(n_clicks, other_info):
# Do actions
return html.P('text')
Reading through previous threads I am can’t seem to find a solution to the above challenge, any pointers/suggestions will be greatly appreciated!