import { ColDef , ColGroupDef , GridOptions } from '@ag-grid-community/core' ; const columnDefs = [ { groupId : 'athleteGroupId' , headerName : 'Athlete' , children : [ { headerName : 'Name' , field : 'athlete' , minWidth : 200 , columnsMenuParams : { suppressColumnFilter : true , suppressColumnSelectAll : true , suppressColumnExpandAll : true , } , } , { field : 'age' , minWidth : 200 , columnsMenuParams : { contractColumnSelection : true , } , } , ] , } , { groupId : 'medalsGroupId' , headerName : 'Medals' , children : [ { field : 'gold' } , { field : 'silver' } , { field : 'bronze' } ] , } , ] ; const gridOptions = { columnDefs : columnDefs , defaultColDef : { flex : 1 , resizable : true , menuTabs : [ 'columnsMenuTab' ] , columnsMenuParams : { suppressSyncLayoutWithGrid : true , } , } , } ; document . addEventListener ( 'DOMContentLoaded' , ( ) => { const gridDiv = document . querySelector ( '#myGrid' ) ; new agGrid . Grid ( gridDiv , gridOptions ) ; fetch ( 'https://www.ag-grid.com/example-assets/olympic-winners.json' ) . then ( response => response . json ( ) ) . then ( data => gridOptions . api ! . setRowData ( data ) ) ; } ) ;