首页 > 解决方案 > AgGrid:如何在运行时动态更改某些列的聚合值?

问题描述

我正在使用 Ag 网格的行分组功能和我预定义的一些列aggFunc

我想要实现的是,一旦网格加载了所有数据,我想根据某些条件隐藏某些列的一些聚合值(行和叶子级)。

我检查了 AgGrid 的 API 文档并在下面进行了尝试,但不幸的是对我没有任何作用。

onButtonClick() {
 this.gridApi.forEachNode((node, index) => {
          if (node.field === 'xyz') {
            // node.aggFunc.abc = 0;   // not working
            // node.aggData.abc = null;  // not working
            // node.setDataValue('abc', null);  // not working
          }
    }
}

任何帮助,将不胜感激。

谢谢

标签: ag-gridag-grid-angularag-grid-grouping

解决方案


尝试这个

columnApi.setColumnAggFunc(colKey, () => '')

推荐阅读