Dash DataTable - Support for Click Events

Here’s a simple working example for Click Events with Dash DataTable:

You can run it here: https://replit.com/@jackparmer1/NarrowAccomplishedDividend#main.py

Code:

import dash
import dash_table as dt
import pandas as pd
import dash_bootstrap_components as dbc
import json
from dash.dependencies import Input, Output

df = pd.read_csv('https://git.io/Juf1t')

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

app.layout = dbc.Container([
    dbc.Label('Click a cell in the table:'),
    dt.DataTable(
        id='tbl', data=df.to_dict('records'),
        columns=[{"name": i, "id": i} for i in df.columns],   
    ),
    dbc.Alert("Click the table", id='out'),
])

@app.callback(
    Output('out', 'children'),
    Input('tbl', 'active_cell'))
def update_graphs(active_cell):
  return json.dumps(active_cell)

if __name__ == "__main__":
    app.run_server(host='0.0.0.0', port=5000, debug=True)