I have a data table. I get the rows no. from the data table via the active cell. Now If some action has to be taken based on each row ID’
Is there a mechanism to put a confirm dialog to get verification (confirm dialog) before every selected row action?
Problem is that if active_cell values are the same the next time, the dialog box keeps coming up again and again to perform the same action repeatedly on the same row id .
If I understand you correctly, it sounds like you may want to create a hidden div and output the active_cell row_id in the callback. Then using the state of that div, compare it to the input of active_cell, if they match do nothing. Otherwise display the DCC confirm.
Thanks Croll for reply ; Here is the code snippet I am dealing with
with following I am repeatedly getting a dialog box fired asking me to take action
( I do have an n interval that updates after lets say 1 min all my divs
Here is the code i am working on
submit_n_clicks State from dialog box confirm_dialog
take_action_table Table that is clicked
take_action_dict a 3 key dictionary that stores the action information
Your code sample doesn’t align with your original question. I am going to provide a sample referring to what I was talking about in my previous post. Hopefully this will help.
create a hidden div to store the active_cell value:
I am not sure why you are hard setting the row and column in your callback. Just compare the values.
@app.callback([Output('messag_show_region', 'children'), Output('store-ac', 'children')], [Input('take_action_table', 'active_cell')], [State('store-ac', 'children')])
def display(ac, storedValue):
selected = ''
if ac['row_id'] != storedValue:
# this is when a new row or the first row is selected
selected = 'New row selected'
else:
#this is when the same row is selected
selected = 'Same row selected'
return [selected, ac['row_id']]