import { GridOptions , SideBarDef } from '@ag-grid-community/core' ; const gridOptions = { columnDefs : [ { field : 'athlete' , filter : 'agTextColumnFilter' , minWidth : 200 } , { field : 'age' } , { field : 'country' , minWidth : 200 } , { field : 'year' } , { field : 'date' , minWidth : 160 } , { field : 'gold' } , { field : 'silver' } , { field : 'bronze' } , { field : 'total' } , ] , defaultColDef : { flex : 1 , minWidth : 100 , enableValue : true , enableRowGroup : true , enablePivot : true , sortable : true , filter : true , } , sideBar : { toolPanels : [ { id : 'columns' , labelDefault : 'Columns' , labelKey : 'columns' , iconKey : 'columns' , toolPanel : 'agColumnsToolPanel' , } , { id : 'filters' , labelDefault : 'Filters' , labelKey : 'filters' , iconKey : 'filter' , toolPanel : 'agFiltersToolPanel' , } , ] , defaultToolPanel : 'filters' , hiddenByDefault : true , } , } ; function setSideBarVisible ( value ) { gridOptions . api ! . setSideBarVisible ( value ) ; } function isSideBarVisible ( ) { alert ( gridOptions . api ! . isSideBarVisible ( ) ) ; } function openToolPanel ( key ) { gridOptions . api ! . openToolPanel ( key ) ; } function closeToolPanel ( ) { gridOptions . api ! . closeToolPanel ( ) ; } function getOpenedToolPanel ( ) { alert ( gridOptions . api ! . getOpenedToolPanel ( ) ) ; } function setSideBar ( def ) { gridOptions . api ! . setSideBar ( def ) ; } function getSideBar ( ) { var sideBar = gridOptions . api ! . getSideBar ( ) ; alert ( JSON . stringify ( sideBar ) ) ; console . log ( sideBar ) ; } function setSideBarPosition ( position ) { gridOptions . api ! . setSideBarPosition ( position ) ; } 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 ) ) ; } ) ;