I have a Dataframe (which shows values when printed in the terminal and also when convereted to a Dash Datatable).
However, when I try to use it to create a Dash AG Grid, only the first column is filled and the others have a header, but nothing else. This is the code for the grid:
import dash_ag_grid as dag
def .................(df_existing):
column_defs = []
for col_index, col_name in enumerate(df_existing.columns):
column_defs.append(
{
"headerName": f"{col_name}",
"field": f"{col_name}",
"width": 500,
"resizable": True,
"filter": True,
}
)
grid = dag.AgGrid(
id="fomparision_table",
className="ag-theme-alpine border",
rowData=df_existing.to_dict("records"),
columnDefs=column_defs,
columnSize="sizeToFit",
dashGridOptions={
"domLayout": "autoHeight",
"columnHoverHighlight": True,
},
style={"height": "100%", "fontSize": "20px"},
)
return grid
When I use the same code for other dataframes, it seems to work.
What could the problem here be?