import { ColDef , GridOptions , ISetFilter } from '@ag-grid-community/core' ; const columnDefs = [ { field : 'athlete' , filter : 'agSetColumnFilter' } ] ; const gridOptions = { columnDefs : columnDefs , defaultColDef : { flex : 1 , minWidth : 150 , filter : true , sortable : true , } , } ; let savedMiniFilterText = '' ; function getMiniFilterText ( ) { const athleteFilter = gridOptions . api ! . getFilterInstance ( 'athlete' ) as ISetFilter ; console . log ( athleteFilter . getMiniFilter ( ) ) ; } function saveMiniFilterText ( ) { const athleteFilter = gridOptions . api ! . getFilterInstance ( 'athlete' ) as ISetFilter ; savedMiniFilterText = athleteFilter . getMiniFilter ( ) ; } function restoreMiniFilterText ( ) { const athleteFilter = gridOptions . api ! . getFilterInstance ( 'athlete' ) as ISetFilter ; athleteFilter . setMiniFilter ( savedMiniFilterText ) ; } function resetFilter ( ) { const athleteFilter = gridOptions . api ! . getFilterInstance ( 'athlete' ) as ISetFilter ; athleteFilter . setModel ( null ) ; gridOptions . api ! . onFilterChanged ( ) ; } 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 ( data => gridOptions . api ! . setRowData ( data ) ) ; } ) ;