Return a Pandas DataFrame in a call back to be used in dag.AgGrid

Hello,
I’ve just started using AG Grid to put together a dashboard to show results of a portfolio analysis depending on user selection from 2 dropdowns:
image

The data is stored on my computer in different csv files, for example user can pick “good” or “bad” market conditions and the app requires to read csv files that are stored in separate folders corresponding to each of the market conditions and show them in interactive tables, for which I want to use Ag.Grid.

Now based on this, I am wondering how to create an empty dag.AgGrid in the layout and then pass a dataframe to it? Can someone pease help with this? I am new to plotly and AgGrid so if this approach is not correct and there is a better way to tackle this issue, would appreciate your comment on it as well.

Thank you,
Lili

Hi @Lili2023

Yes, you can update the data in the grid from a callback. You can see an example here:

Note that if the columns in the csv files are different, then you will have to update both the rowData and the column definitions( columnDefs and/or defaultColDef) in the calback.

1 Like

Thank you very much @AnnMarieW! this solved my problem.

All the best,
Lili

1 Like