import { Grid , GridOptions } from "ag-grid-community" ; import "ag-grid-enterprise" ; export class SimpleGrid { private readonly gridOptions : GridOptions = { } ; constructor ( selector , gridModule ) { this . gridOptions = { columnDefs : this . createColumnDefs ( ) , rowData : this . createRowData ( ) , enableCharts : true , enableRangeSelection : true } ; let eGridDiv = < HTMLElement > document . querySelector ( selector ) ; new Grid ( eGridDiv , this . gridOptions , { modules : [ gridModule ] } ) ; } private createColumnDefs ( ) { return [ { headerName : "Make" , field : "make" } , { headerName : "Model" , field : "model" } , { headerName : "Price" , field : "price" , enableValue : true } ] ; } private createRowData ( ) { return [ { make : "Toyota" , model : "Celica" , price : 35000 } , { make : "Ford" , model : "Mondeo" , price : 32000 } , { make : "Porsche" , model : "Boxter" , price : 72000 } ] ; } }