Skip to content

groupAggFiltering not allowed to be function in the dashGridOptions #471

Description

@vivalf

Hello,

Following the documentation of ag grid regarding the filtering when using aggregation. I tried to use the "groupAggFiltering" in the grid options with a javascript function (see https://www.ag-grid.com/javascript-data-grid/aggregation-filtering/#configure-by-callback).

However, it seems that dash-ag-grid does not recognise groupAggFiltering as a possible JS function and the JS function is not executed.

Hence the provided example below does not execute the code in groupAggFiltering:



app = Dash()

df = pd.read_csv(
    "https://raw.githubusercontent.com/plotly/datasets/master/ag-grid/olympic-winners.csv"
)

columnDefs = [
    # Row group by country and by year is enabled.
    {
        "field": "country",
        "rowGroup": True,
        "hide": True,
        "suppressColumnsToolPanel": True,
    },
    {
        "field": "sport",
        "rowGroup": True,
        "hide": True,
        "suppressColumnsToolPanel": True,
    },
    {
        "field": "year",
        "pivot": True,
        "hide": True,
        "suppressColumnsToolPanel": True,
    },
    {"field": "gold", "sortable": True, "filter": True, "aggFunc": "sum"},
    {"field": "silver", "sortable": True, "filter": True, "aggFunc": "sum"},
    {
        "headerName": "ratio",
        "colId": "goldSilverRatio",
        "aggFunc": {"function": "ratioAggFunc(params)"},
        "valueGetter": {"function": "ratioValueGetter(params)"},
        "valueFormatter": {"function": "ratioFormatter(params)"},
    },
]

app.layout = html.Div(
    [
        dag.AgGrid(
            id="example",
            enableEnterpriseModules=True,
            columnDefs=columnDefs,
            rowData=df.to_dict("records"),
            dashGridOptions={groupAggFiltering":{"function":"!!params.node.group" }
        ),
    ]
)

I think this can be solved by adding groupAggFiltering to the list of GRID_MAYBE_FUNCTIONS in "propCategories.js".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions