1

I am actually working on a dash project. In this one, I have a datatable which is updated each 5 seconds. When I click on a cell of the datatable (= when active_cell is not None), the is_open parameter of my modal is set to true and values depending on the selected cell are pushed to the modal.

Only problem : while the modal is opened, the datas must be automatically actualized depending on the datatable evolution (=datatable is an input in my callback). But the problem is that when I close the modal manually, it will keep opening again and again each time the datatable is updated (because the cell is still active).

So here I come to my question : How can I unselect the cell when I close the modal ? Because active_cell is an input in the callback so I can't update it in the same callback. Here is the code of my callback :

@app.callback(Output('graph', 'figure'),
              Output('modal_graph', 'is_open'),
              Input('tbl', 'active_cell'),
              Input('tbl', 'data'),
              )
def update_graphs(active_cell, datatb):
    datas = FundamentalDatas.instance()
    if active_cell and (active_cell['column'] != 0):
        try:
            return datas.create_graph(active_cell, datatb), True
        except Exception:
            raise PreventUpdate
    else:
        raise PreventUpdate

Thanks by advance !

Ces
  • 76
  • 1
  • 7

0 Answers0