我在ag-grid中有数据透视表,我已启用它
gridOptions.pivotColumnGroupTotals = after
。
但默认设置是组总计折叠其他值。
有没有办法让这个分组总计开始默认打开?
理想情况下,我可以指定默认情况下应打开哪一列。
谢谢!
使用
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!';
}
}
]
},
看这里:
https://ag-grid.com/angular-data-grid/pivoting/#expandable-pivot-column-groups
在Python中,这将打开到第4层,我认为-1设置全部打开:
dag.AgGrid(
dashGridOptions={
"pivotDefaultExpanded" : 4,
})