import { ColDef , GridOptions , RowSpanParams } from '@ag-grid-community/core' ; function rowSpan ( params ) { var athlete = params . data . athlete ; if ( athlete === 'Aleksey Nemov' ) { return 2 ; } else if ( athlete === 'Ryan Lochte' ) { return 4 ; } else { return 1 ; } } const columnDefs = [ { field : 'athlete' , rowSpan : rowSpan , cellClassRules : { 'cell-span' : "value==='Aleksey Nemov' || value==='Ryan Lochte'" , } , width : 200 , } , { field : 'age' , width : 100 } , { field : 'country' } , { field : 'year' , width : 100 } , { field : 'date' } , { field : 'sport' } , { field : 'gold' } , { field : 'silver' } , { field : 'bronze' } , { field : 'total' } , ] ; const gridOptions = { columnDefs : columnDefs , defaultColDef : { width : 170 , resizable : true , } , suppressRowTransform : true , } ; document . addEventListener ( 'DOMContentLoaded' , function ( ) { var 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 ) ) ; } ) ;