AG grid filtering with dcc

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 :slight_smile:

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"},],
                                    defaultColDef = {
                                        'sortable': True
                                                    'sortingOrder': ['desc', 'asc', None],
                                                    "accentedSort": True


                            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))


    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

1 Like