from dash import Dash, html, dcc, Input, Output
import dash_ag_grid as dag
import pandas as pd
app = Dash()
df = pd.read_csv(
"https://raw.githubusercontent.com/plotly/datasets/master/ag-grid/olympic-winners.csv"
)
app.layout = html.Div([
dcc.Store(id="store-button"),
dag.AgGrid(
id="column-definition-ID",
rowData=df.to_dict("records"),
columnDefs=[{
"field": "athlete",
"headerName": "Athlete",
"headerComponent": "ButtonHeader" # select custom component
}],
columnSize="sizeToFit",
),
html.Div(id="container")
])
@app.callback(
Output("container", "children"),
Input("store-button", "data")
)
def update(data):
return str(data)
if __name__== "__main__":
app.run(debug=True)