import { ColDef , GridOptions , IRowDragItem } from '@ag-grid-community/core' ; var rowDragText = function ( params ) { if ( params . rowNode ! . data . year == '2012' ) { return params . defaultTextValue + ' (London Olympics)' ; } return params . defaultTextValue ; } ; const columnDefs = [ { field : 'athlete' , rowDrag : true , rowDragText : rowDragText , } , { field : 'country' } , { field : 'year' , width : 100 } , { field : 'date' } , { field : 'sport' } , { field : 'gold' } , { field : 'silver' } , { field : 'bronze' } , ] ; const gridOptions = { defaultColDef : { width : 170 , sortable : true , filter : true , } , rowDragManaged : true , columnDefs : columnDefs , animateRows : true , } ; 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 ) ) ; } ) ;