import { CheckboxSelectionCallbackParams , ColDef , GridOptions , HeaderCheckboxSelectionCallbackParams , ValueGetterParams } from '@ag-grid-community/core' ; var checkboxSelection = function ( params ) { return params . columnApi . getRowGroupColumns ( ) . length === 0 ; } ; var headerCheckboxSelection = function ( params ) { return params . columnApi . getRowGroupColumns ( ) . length === 0 ; } ; const columnDefs = [ { field : 'athlete' , minWidth : 170 , checkboxSelection : checkboxSelection , headerCheckboxSelection : headerCheckboxSelection , } , { field : 'age' } , { field : 'country' } , { field : 'year' } , { field : 'date' } , { field : 'sport' } , { field : 'gold' } , { field : 'silver' } , { field : 'bronze' } , { field : 'total' } , ] ; var autoGroupColumnDef = { headerName : 'Group' , minWidth : 170 , field : 'athlete' , valueGetter : function ( params ) { if ( params . node ! . group ) { return params . node ! . key ; } else { return params . data [ params . colDef . field ! ] ; } } , headerCheckboxSelection : true , cellRenderer : 'agGroupCellRenderer' , cellRendererParams : { checkbox : true , } , } ; const gridOptions = { defaultColDef : { editable : true , enableRowGroup : true , enablePivot : true , enableValue : true , sortable : true , resizable : true , filter : true , flex : 1 , minWidth : 100 , } , suppressRowClickSelection : true , groupSelectsChildren : true , debug : true , rowSelection : 'multiple' , rowGroupPanelShow : 'always' , pivotPanelShow : 'always' , enableRangeSelection : true , columnDefs : columnDefs , paginationAutoPageSize : true , pagination : true , autoGroupColumnDef : autoGroupColumnDef , } ; 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 ) ) ; } ) ;