Hi There,
Wondering if aggrid works in a multipage app? I have a single page app which updates the ‘rowData’ prop using a callback and works fine, I also have the exact same code but in a multipage app and I get the below error:
A nonexistent object was used in an Output
of a Dash callback. The id of this object is g10_table
and the property is rowData
. The string ids in the current layout are: [url, load, data_memory, position_data_memory_eur, position_data_memory_jpy, eur_traded_memory, jpy_traded_memory, wmr_memory, ccy_dropdown_store, em_bar_memory, dm_bar_memory, date_picker, button_eur, _pages_location, _pages_content, _pages_store, _pages_dummy, table_header_2, em_table, broker_vol_bar]
In the app.layout, I am defining all the necessary attributes of the aggrid table:
dag.AgGrid(
id='g10_table',
columnDefs=[
{"headerName": "Row ID",
"valueGetter": {"function": "params.node.id"},
"checkboxSelection": True
},
{
"headerName": "CURRENCY",
"field": "CCY",
"filter": True,
"headerTooltip": "The currency of the trade"
},
{
"headerName": "AVG SPOT RATE",
"field": "Avg Spot Rate",
"valueFormatter": "Number(value)",
"headerTooltip": "Average spot rate traded for the specific currency",
"cellRenderer": "agAnimateShowChangeCellRenderer",
},
{
"headerName": "ANNUALIZED 1YR (%)",
"field": "Annualized 1Y (%)",
"valueFormatter": "Number(value)",
"headerTooltip": "Annualized cost/benefit of trading the forward rate bias",
"cellRenderer": "agAnimateShowChangeCellRenderer",
},
{
"headerName": "WMR4 INTER POINTS",
"field": "WMR4 Inter Points",
"valueFormatter": "Number(value)",
"headerTooltip": "London 4pm interpolated points based on the day count",
"cellRenderer": "agAnimateShowChangeCellRenderer",
},
{
"headerName": "NEAR DATE",
"field": "Near Date",
"type": "rightAligned",
"headerTooltip": "Settlement date for the near leg"
},
{
"headerName": "FAR DATE",
"field": "Far Date",
"type": "rightAligned",
"headerTooltip": "Settlement date for the far leg",
"cellRenderer": "agAnimateShowChangeCellRenderer",
},
{
"headerName": "WMR4 1M DAY COUNT",
"field": "WMR 1M Days",
"valueFormatter": "Number(value)",
"cellRenderer": "agAnimateShowChangeCellRenderer",
"headerTooltip": "Number of days between spot and forward settlement dates for the benchmark"
},
{
"headerName": "WMR4 MONTH END DATE",
"field": "WMR4 Eff Date",
"valueFormatter": "Number(value)",
"headerTooltip": "Month ENd date used by the benchmark",
"cellRenderer": "agAnimateShowChangeCellRenderer",
},
],
columnSize="sizeToFit",
defaultColDef=defaultColDef,
dashGridOptions={"undoRedoCellEditing": True,
"rowSelection": "single",
"tooltipShowDelay": 500
},
style={"width": "100%"}
)
Then I have a callback to set and generate the rowData
@callback([Output('g10_table', 'rowData'),
Output('table_header_1', 'children'), Output('dm_bar_memory', 'data')],
[Input('data_memory', 'data'), Input('wmr_memory', 'data')])
def update_g10_table(data, data_wmr):
global df_table
if data is None:
return None, dcc.Markdown(
f''' No G10 rolls have been captured yet for the selected start date...'''), None
df_table, df_fx = get_currency_table(data, pd.read_json(data_wmr['wmr_store']))
if df_table is None:
return None, dcc.Markdown(
f''' No G10 rolls have been captured yet for the selected start date...'''), None
display(df_table)
datasets = {'DM': df_fx.to_json(orient='columns'), 'ALL': df_table.to_json(orient='columns')}
return df_table.to_dict('records'), dcc.Markdown(
f''' G10 rolls summary for the selected start date'''), datasets
I also tripple checked the grid field names vs the dataframe and ensured there is data being printed out.
@AnnMarieW would greatly appreciate your help