import { GridOptions , GridReadyEvent } from "@ag-grid-community/core" ; var gridOptions = { columnDefs : [ { headerName : 'Col 1' , colId : 'firstCol' , field : 'height' } , { headerName : 'Col 2' , colId : 'firstCol' , field : 'height' } , { headerName : 'Col 3' , field : 'height' } , { headerName : 'Col 4' , field : 'height' } , { headerName : 'Col 5' , valueGetter : 'data.width' } , { headerName : 'Col 6' , valueGetter : 'data.width' } ] , rowData : createRowData ( ) , onGridReady : function ( params ) { var cols = params . columnApi . getAllColumns ( ) ! ; cols . forEach ( function ( col ) { var colDef = col . getColDef ( ) ; console . log ( colDef . headerName + ', Column ID = ' + col . getId ( ) , JSON . stringify ( colDef ) ) ; } ) ; } } ; function createRowData ( ) { var data = [ ] ; for ( var i = 0 ; i < 20 ; i ++ ) { data . push ( { height : Math . floor ( Math . random ( ) * 100 ) , width : Math . floor ( Math . random ( ) * 100 ) , depth : Math . floor ( Math . random ( ) * 100 ) } ) ; } return data ; } document . addEventListener ( 'DOMContentLoaded' , function ( ) { var gridDiv = document . querySelector ( '#myGrid' ) ; new agGrid . Grid ( gridDiv , gridOptions ) ; } ) ;