import { GridOptions } from '@ag-grid-community/core' ; const gridOptions = { defaultColDef : { editable : true , resizable : true , minWidth : 100 , flex : 1 , } , suppressExcelExport : true , popupParent : document . body , columnDefs : [ { field : 'athlete' } , { field : 'country' } , { field : 'sport' } , { field : 'gold' , hide : true } , { field : 'silver' , hide : true } , { field : 'bronze' , hide : true } , { field : 'total' } , ] , rowData : getData ( ) } ; function getBoolean ( id ) { var field = document . querySelector ( '#' + id ) ; return ! ! field . checked ; } function getParams ( ) { return { allColumns : getBoolean ( 'allColumns' ) , } ; } function onBtnExport ( ) { gridOptions . api ! . exportDataAsCsv ( getParams ( ) ) ; } function onBtnUpdate ( ) { ( document . querySelector ( '#csvResult' ) as any ) . value = gridOptions . api ! . getDataAsCsv ( getParams ( ) ) ; } document . addEventListener ( 'DOMContentLoaded' , function ( ) { var gridDiv = document . querySelector ( '#myGrid' ) ; new agGrid . Grid ( gridDiv , gridOptions ) ; } ) ;