答案 0 :(得分:0)
您可以参考以下链接 https://www.ag-grid.com/javascript-grid-grouping-headers/
例如:
gridOptions.columnDefs = [
{
headerName: "Athlete Details",
children: [
{headerName: "Name", field: "name"},
{headerName: "Age", field: "age"},
{headerName: "Country", field: "country"}
]
},
{
headerName: "Sports Results",
children: [
{headerName: "Sport", field: "sport"},
{headerName: "Total", columnGroupShow: 'closed'},
{headerName: "Gold", columnGroupShow: 'open'},
{headerName: "Silver", columnGroupShow: 'open'},
{headerName: "Bronze", columnGroupShow: 'open'}
]
}
];