ag-grid 枢轴总列默认打开

问题描述 投票:0回答:2

我在ag-grid中有数据透视表,我已启用它

gridOptions.pivotColumnGroupTotals = after
。 但默认设置是组总计折叠其他值。

有没有办法让这个分组总计开始默认打开?

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

谢谢!

pivot ag-grid
2个回答
1
投票

使用

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!';
            }
        }
    ]
},

0
投票

看这里:

https://ag-grid.com/angular-data-grid/pivoting/#expandable-pivot-column-groups

在Python中,这将打开到第4层,我认为-1设置全部打开:

  dag.AgGrid(
                            dashGridOptions={
                                             "pivotDefaultExpanded" : 4,
                            })

© www.soinside.com 2019 - 2024. All rights reserved.