默认情况下,ag-grid数据透视总数列处于打开状态

时间:2020-07-03 13:30:35

标签: pivot ag-grid

我在启用了gridOptions.pivotColumnGroupTotals = after的ag-grid中有数据透视表。 但是默认设置是将组总计折叠其他值。

默认情况下是否有办法使此分组总数开始?

理想情况下,我可以指定默认情况下应打开哪一列。

谢谢!

1 个答案:

答案 0 :(得分:0)

使用openByDefault属性,同时声明您的列组对象,导致这些组默认情况下显示为打开。。

这是示例代码片段。

    //column group 'Performance'
    headerName: 'Performance',
    groupId: 'performance',
    openByDefault : true, //this tells AG grid to expand the children by default
    children: [
        {
            headerName: "Bank Balance", field: "bankBalance", width: 180, editable: true,
            filter: 'winningsFilter',
            valueFormatter: currencyFormatter,
            type: 'numericColumn',
            cellClassRules: {
                'currencyCell': 'typeof x == "number"'
            },
            enableValue: true,
            // colId: 'sf',
            // valueGetter: '55',
            // aggFunc: 'sum',
            icons: {
                sortAscending: '<i class="fa fa-sort-amount-up"/>',
                sortDescending: '<i class="fa fa-sort-amount-down"/>'
            }
        },
        {
            colId: 'extraInfo1',
            headerName: "Extra Info 1", columnGroupShow: 'open', width: 150, editable: false, filter: false,
            sortable: false, suppressMenu: true, cellStyle: { "text-align": "right" },
            cellRenderer: function() {
                return 'Abra...';
            }
        },
        {
            colId: 'extraInfo2',
            headerName: "Extra Info 2", columnGroupShow: 'open', width: 150, editable: false, filter: false,
            sortable: false, suppressMenu: true, cellStyle: { "text-align": "left" },
            cellRenderer: function() {
                return '...cadabra!';
            }
        }
    ]
},