import { FirstDataRenderedEvent , GridOptions , IFiltersToolPanel , KeyCreatorParams , ValueFormatterParams , } from '@ag-grid-community/core' ; const gridOptions = { columnDefs : [ { headerName : 'Country (Complex Object)' , field : 'country' , keyCreator : countryKeyCreator , valueFormatter : countryValueFormatter , filter : 'agSetColumnFilter' , } , ] , defaultColDef : { flex : 1 , floatingFilter : true , } , sideBar : 'filters' , onFirstDataRendered : onFirstDataRendered , } ; function countryKeyCreator ( params ) { var countryObject = params . value ; return countryObject . name ; } function countryValueFormatter ( params ) { return params . value . name ; } function printFilterModel ( ) { var filterModel = gridOptions . api ! . getFilterModel ( ) ; console . log ( filterModel ) ; } function onFirstDataRendered ( params ) { ; ( ( params . api . getToolPanelInstance ( 'filters' ) as any ) as IFiltersToolPanel ) . expandFilters ( ) ; } 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 ( function ( data ) { data . forEach ( function ( row ) { var countryName = row . country ; var countryCode = countryName . substring ( 0 , 2 ) . toUpperCase ( ) ; row . country = { name : countryName , code : countryCode , } ; } ) ; gridOptions . api ! . setRowData ( data ) ; } ) ; } ) ;