I’d like to be able to filter an AG grid using dropdowns and sliders as in this video:
I can get a dropdown to work for a data table but the callback does not seem to update an ag grid.
Is this not possible or is there an alternative way to do this?
I’d like to be able to filter an AG grid using dropdowns and sliders as in this video:
I can get a dropdown to work for a data table but the callback does not seem to update an ag grid.
Is this not possible or is there an alternative way to do this?
Hi @EffectiveFball and welcome to the Dash community ![]()
Can you post the code for what you have tried so far?
layout = dbc.Container([dbc.Row([
grid := dag.AgGrid(
columnDefs=[{"field": "Player", "pinned": "left"},
{"field": "Position"},
{"field": "Deep Defending"},
{"field": "Aerial"},
{"field": "Tackling"},
{"field": "Recovering"},
{"field": "Passing"},
{"field": "Pass Progression"},
{"field": "Control"},
{"field": "Dribbling"},
{"field": "Creating"},
{"field": "Scoring"},],
rowData=dfp.to_dict("records"),
defaultColDef = {
'sortable': True
},
dashGridOptions={
'sortingOrder': ['desc', 'asc', None],
"accentedSort": True
}
)
]),
dbc.Row([
dbc.Col(player := dcc.Dropdown(options=dfp['Player'], multi=True)),
dbc.Col(position := dcc.Dropdown(options=['CB','FB','DM','CM','AM','W','ST'], multi=True))
])
])
@callback(
Output(grid, 'data'),
Input(player, 'value'),
#Input(position, 'value'),
)
def update_grid(player_v):
dfx = dfp.copy()
if player_v:
dfx = dfx[dfx.Player.isin(player_v)]
return dfx.to_dict('records')
I think Output should be rowData, not data.
Yes! Thank you so much