Skip to content

add totalValueGetter to propCategories#450

Merged
AnnMarieW merged 5 commits intoplotly:v35from
AnnMarieW:update-propCategories-totalValueGetter
Apr 22, 2026
Merged

add totalValueGetter to propCategories#450
AnnMarieW merged 5 commits intoplotly:v35from
AnnMarieW:update-propCategories-totalValueGetter

Conversation

@AnnMarieW
Copy link
Copy Markdown
Collaborator

@AnnMarieW AnnMarieW commented Apr 11, 2026

Fix issue as reported on the forum

Sample app

import dash
from dash import html
import dash_ag_grid as dag
import pandas as pd

app = dash.Dash()


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

column_defs = [
    {"field": "country", "rowGroup": True, "hide": True},
    {"field": "year", "rowGroup": True, "hide": True},
    {"field": "gold", "aggFunc": "sum"},
    {"field": "silver", "aggFunc": "sum"},
    {"field": "bronze", "aggFunc": "sum"},
]

default_col_def = {
    "flex": 1,
    "minWidth": 150,
}

auto_group_column_def = {
    "minWidth": 300,
    "cellRendererParams": {
      #  "innerRenderer": "myInnerRenderer",
         "totalValueGetter": {"function": "myTotalValueGetter(params)"},
    },
}

app.layout = html.Div(
    [
        dag.AgGrid(
            id="grid",
            rowData=df.to_dict("records"),
            columnDefs=column_defs,
            defaultColDef=default_col_def,
            enableEnterpriseModules=True,

            dashGridOptions={
                "autoGroupColumnDef": auto_group_column_def,
                "groupTotalRow":"bottom",
                "grandTotalRow":"bottom",

            },            
        )
    ]
)

if __name__ == "__main__":
    app.run(debug=True)
var dagcomponentfuncs = window.dashAgGridComponentFunctions = window.dashAgGridComponentFunctions || {};
var dagfuncs = window.dashAgGridFunctions = window.dashAgGridFunctions || {};

dagfuncs.myTotalValueGetter = function (params) {
   console.log("value", params)
    const isRootLevel = params.node.level === -1;

        if (isRootLevel) {
          return 'Grand Total';
        }
        
        return `Sub Total (${params.value})`;
    }

dagcomponentfuncs.myInnerRenderer = function (props) {
    console.log("inner")
    const footer = props.node.footer;
    const isRootLevel = props.node.level === -1;
    const value = props.value;

    if (footer) {
        if (isRootLevel) {
            return React.createElement(
                "span",
                {
                    style: {
                        textDecoration: "underline",
                        fontWeight: "bold"
                    }
                },
                "Grand Total"
            );
        } else {
            return React.createElement(
                "span",
                {
                    style: {
                        textDecoration: "underline"
                    }
                },
                "Sub Total " + value
            );
        }
    }

    return React.createElement("span", null, value);
};

ndrezn and others added 4 commits April 3, 2026 09:52
Replaces the single publish.yml with:
- pypi-publish.yml: publishes to PyPI on release
- npm-publish.yml: publishes to npm on release + supports manual trigger via workflow_dispatch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Split publish into separate PyPI and npm workflows
@AnnMarieW AnnMarieW changed the base branch from main to v35 April 13, 2026 14:00
@AnnMarieW AnnMarieW requested a review from BSd3v April 22, 2026 14:33
Copy link
Copy Markdown
Collaborator

@BSd3v BSd3v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃 add changelog updates in the next PR

@AnnMarieW AnnMarieW merged commit 4d5f136 into plotly:v35 Apr 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants