Hi,
I have an AgGrid without data defined in layout and I update the rowData
and selectedRows
in a callback like in the example below:
from dash import Dash, html, Output, Input
import dash_ag_grid as dag
import pandas as pd
df = pd.DataFrame(
dict(
A=[1,2,3],
B=[3,4,5]
)
)
app = Dash(prevent_initial_callbacks=True)
app.layout = html.Div(
[
html.Button(id="btn", children="Select first row"),
dag.AgGrid(
id="aggrid",
dashGridOptions={
"rowSelection": "single",
"suppressRowClickSelection": True,
},
columnDefs=[
{
"headerName": "A",
"field": "A",
"showDisabledCheckboxes": True,
"checkboxSelection": True,
},
{
"headerName": "B",
"field": "B",
},
]
)
]
)
@app.callback(
Output("aggrid", "rowData"),
Output("aggrid", "selectedRows"),
Input("btn", "n_clicks"),
)
def update_selected_rows(n_clicks):
return [df.to_dict("records"), df.head(1).to_dict("records")]
if __name__ == "__main__":
app.run_server(debug=True)
The problem is that when I run this with
- dash = “2.14.2”
- dash-ag-grid = “31.0.0”
the selected rows passed in the callback do not show as selected.
It works as expected when using
- dash = “2.13.0”
- dash-ag-grid = “2.4.0”