import { GridOptions , ValueGetterParams } from '@ag-grid-community/core' ; const gridOptions = { columnDefs : [ { field : 'country' , rowGroup : true , hide : true } , { field : 'year' , rowGroup : true , hide : true } , { field : 'gold' , aggFunc : 'sum' } , { field : 'silver' , aggFunc : 'sum' } , { field : 'bronze' , aggFunc : 'sum' } , ] , defaultColDef : { flex : 1 , minWidth : 150 , filter : true , floatingFilter : true , resizable : true , } , autoGroupColumnDef : { filterValueGetter : ( params ) => { const colId = params . column . getColId ( ) ; if ( colId . includes ( 'country' ) ) { return params . data . country ; } if ( colId . includes ( 'year' ) ) { return params . data . year ; } } , } , groupDisplayType : 'multipleColumns' , animateRows : true , rowData : getData ( ) , } ; document . addEventListener ( 'DOMContentLoaded' , function ( ) { var gridDiv = document . querySelector ( '#myGrid' ) ; new agGrid . Grid ( gridDiv , gridOptions ) ; } ) ;