import { ColDef , GridOptions } from '@ag-grid-community/core' ; const columnDefs = [ { headerName : 'ID' , valueGetter : 'node.rowIndex + 1' , width : 70 } , { field : 'model' , width : 150 } , { field : 'color' } , { field : 'price' , valueFormatter : '"$" + value.toLocaleString()' } , { field : 'year' } , { field : 'country' } , ] ; const gridOptions = { columnDefs : columnDefs , rowData : getData ( ) , defaultColDef : { width : 100 , } , } ; function onBtPrinterFriendly ( ) { var eGridDiv = document . querySelector ( '#myGrid' ) as any ; eGridDiv . style . width = '' ; eGridDiv . style . height = '' ; gridOptions . api ! . setDomLayout ( 'print' ) ; } function onBtNormal ( ) { var eGridDiv = document . querySelector ( '#myGrid' ) as any ; eGridDiv . style . width = '400px' ; eGridDiv . style . height = '200px' ; gridOptions . api ! . setDomLayout ( ) ; } document . addEventListener ( 'DOMContentLoaded' , function ( ) { var gridDiv = document . querySelector ( '#myGrid' ) ; new agGrid . Grid ( gridDiv , gridOptions ) ; } ) ;