What's New Copy Link
See the release post for details of what's new in version 31.1.
Codemods Copy Link
Follow these steps to upgrade your project's AG Grid version to 31.1.0:
Locate your project's
package.jsonand note the version of AG Grid that you are currently using.Update any AG Grid dependencies listed in your project's
package.jsonto version31.1.0.Open a terminal and navigate to your project's root folder.
Run the
migratecommand of version31.1of the AG Grid codemod runner, where$FROM_VERSIONrefers to your project's existing AG Grid version:npx @ag-grid-devtools/cli@latest migrate --from=$FROM_VERSION --to=31.1This will update your project's source files to prepare for the new release.
By default the Codemod runner will locate all source files within the current directory. For projects with more specific requirements, pass a list of input files to the
migratecommand, or specify the--helpargument to see more fine-grained usage instructions.
The Codemod runner will check the state of your project to ensure that you don't lose any work. If you would rather see a diff of the changes instead of applying them, pass the --dry-run argument.
The codemod only transforms source files that make use of deprecated features, so if you aren't currently making use of any of those APIs your source code will be unaffected by the codemod.
See the Codemods documentation for more details.
Migrating Custom Components to Use reactiveCustomComponents Option Copy Link
Custom components can now be created more easily by setting reactiveCustomComponents. Custom components built in an imperative way (without setting reactiveCustomComponents) may need to be rebuilt in order to work with the setting enabled. Using custom components built in an imperative way is now deprecated, and in AG Grid v32 the reactiveCustomComponents option will be true by default, and custom components built in an imperative way will still be supported as an optional behaviour.
Please note that enabling this setting affects all custom components and you cannot use a mix of reactive custom components and imperative custom components in the same grid instance.
Custom Cell Editor Components Copy Link
getValueis no longer used. The component will be passedvalueas a prop with the latest value (andinitialValuewith the value when editing started). When the value is updated in the UI, the component should call the proponValueChangewith the updated value.- Any other date methods defined via
useImperativeHandleshould now be defined as callbacks, and passed to the new hookuseGridCellEditor. These are all optional; the hook is only needed if the callbacks are required. - If using
api.getCellEditorInstances, the instance returned will now be a wrapper. To get the React custom cell editor component, use the helper functiongetInstancewith the returned wrapper instance. See Accessing Cell Editor Instances.
See Implementing a Cell Editor Component for examples and more details on the interfaces.
Custom Date Components Copy Link
getDateandsetDateare no longer used. The component will be passeddateas a prop with the latest date. When the date is updated in the UI, the component should call the proponDateChangewith the updated date (instead of calling the proponDateChangedwhen the date changes).- Any other editing methods defined via
useImperativeHandleshould now be defined as callbacks, and passed to the new hookuseGridDate. These are all optional; the hook is only needed if the callbacks are required.
See Implementing a Date Component for examples and more details on the interfaces.
Custom Filter Components Copy Link
isFilterActivemethod is no longer used. If the model isnull, the filter is treated as inactive.getModelandsetModelare no longer used. The component will be passedmodelas a prop with the latest model. When the filter is updated in the UI, the component should call the proponModelChangewith the updated model (instead of calling the propfilterChangedCallbackwhen the model changes).- The
filterModifiedCallbackprop is replaced with the proponUiChange. - Any other filter methods defined via
useImperativeHandleshould now be defined as callbacks, and passed to the new hookuseGridFilter.doesFilterPassis a mandatory callback; all others are optional. - If using
api.getColumnFilterInstance(orapi.getFilterInstance, which has been deprecated byapi.getColumnFilterInstance), the instance returned will now be a wrapper. To get the React custom filter component, use the helper functiongetInstancewith the returned wrapper instance. See Accessing the Component Instance.
See Implementing a Filter Component for examples and more details on the interfaces.
Custom Floating Filter Components Copy Link
onParentModelChangedis no longer used. The component will be passedmodelas a prop with the latest model. When the filter is updated in the UI, the component should call the proponModelChangewith the updated model (instead of calling the propparentFilterInstanceand setting the updated value directly on the parent filter instance when the model changes).- Any other filter methods defined via
useImperativeHandleshould now be defined as callbacks, and passed to the new hookuseGridFloatingFilter. These are all optional; the hook is only needed if the callbacks are required.
See Implementing a Floating Filter Component for examples and more details on the interfaces.
Custom Status Bar Panel Components Copy Link
- If using
api.getStatusPanel, the instance returned will now be a wrapper. To get the React custom status bar panel component, use the helper functiongetInstancewith the returned wrapper instance. See Accessing Status Bar Panel Instances.
Deprecations Copy Link
This release includes the following deprecations:
React Copy Link
AgReactUiProps- deprecated, useAgGridReactPropsinstead.AgGridReactProps.disableStaticMarkup,AgGridReactProps.legacyComponentRendering- deprecated, as they are no longer used.
The following React custom component interfaces are deprecated along with their methods:
getReactContainerStyleandgetReactContainerClasses- deprecated, apply styling directly to the CSS class.ag-react-containerif needed.IHeaderGroupReactComp- deprecated, useIHeaderGroupinstead.IHeaderReactComp- deprecated, useIHeaderinstead.IDateReactComp- deprecated, useIDateinstead.IFilterReactComp- deprecated, useIFilterinstead.IFloatingFilterReactComp- deprecated, useIFloatingFilterinstead.ICellRendererReactComp- deprecated, useICellRendererinstead.ICellEditorReactComp- deprecated, useICellEditorinstead.ILoadingCellRendererReactComp- deprecated, no interface needed.ILoadingOverlayReactComp- deprecated, useILoadingOverlayinstead.INoRowsOverlayReactComp- deprecated, useINoRowsOverlayinstead.IStatusPanelReactComp- deprecated, useIStatusPanelinstead.IToolPanelReactComp- deprecated, useIToolPanelinstead.ITooltipReactComp- deprecated, no interface needed.
GridOptions Copy Link
gridOptions.cellFlashDelay- deprecated, usegridOptions.cellFlashDurationinstead.gridOptions.cellFadeDelay- deprecated, usegridOptions.cellFadeDurationinstead.colDef.floatingFilterComponentParams.suppressFilterButton- deprecated, usecolDef.suppressFloatingFilterButtoninstead.suppressServerSideInfiniteScroll- deprecated without replacement.serverSideSortOnServer- deprecated without replacement.serverSideFilterOnServer- deprecated without replacement.
Column Filters Copy Link
api.getFilterInstance- deprecated, useapi.getColumnFilterInstanceinstead. To get/set individual filter models, useapi.getColumnFilterModelorapi.setColumnFilterModelinstead.
Column API Copy Link
suppressMenu- deprecated, usesuppressHeaderMenuButtoninstead.columnsMenuParams- deprecated, usecolumnChooserParamsinstead.column.getMenuTabs- deprecated, usecolumns.getColDef.menuTabs ?? defaultValuesinstead.
Grid API Copy Link
getModel- deprecated, use grid API methods listed in Accessing Data.getModel().getRow(index)- deprecated, useapi.getDisplayedRowAtIndex(index)instead.getModel().getRowNode(id)- deprecated, useapi.getRowNode(id)instead.getModel().getRowCount()- deprecated, useapi.getDisplayedRowCount()instead.getModel().isEmpty()- deprecated, use!!api.getDisplayedRowCount()instead.getModel().forEachNode()- deprecated, useapi.forEachNode()instead.getFirstDisplayedRow- deprecated, useapi.getFirstDisplayedRowIndexinstead.getLastDisplayedRow- deprecated, useapi.getLastDisplayedRowIndexinstead.flashCells,flashDelayandfadeDelayparams are deprecated in favor offlashDurationandfadeDurationparams.showColumnMenuAfterButtonClick- deprecated, useIHeaderParams.showColumnMenuwithin a header component, orapi.showColumnMenuelsewhere.showColumnMenuAfterMouseClick- deprecated, useIHeaderParams.showColumnMenuAfterMouseClickwithin a header component, orapi.showColumnMenuelsewhere.removeRowGroupColumn- deprecated, useremoveRowGroupColumnsproviding the single string input param in an array instead.addRowGroupColumn- deprecated, useaddRowGroupColumnsproviding the single string input param in an array instead.setColumnPinned- deprecated, usesetColumnsPinnedproviding the single string input param in an array instead.removePivotColumn- deprecated, useremovePivotColumnsproviding the single string input param in an array instead.addPivotColumn- deprecated, useaddPivotColumnsproviding the single string input param in an array instead.addAggFunc- deprecated, useaddAggFuncsproviding the single string input param in an array instead.removeValueColumn- deprecated, useremoveValueColumnsproviding the single string input param in an array instead.addValueColumn- deprecated, useaddValueColumnsproviding the single string input param in an array instead.autoSizeColumn- deprecated, useautoSizeColumnsproviding the single string input param in an array instead.moveColumn- deprecated, usemoveColumnsproviding the single string input param in an array instead.setColumnWidth- deprecated, usesetColumnWidthsproviding the single string input param in an array instead.setColumnVisible- deprecated, usesetColumnsVisibleproviding the single string input param in an array instead.
Custom Components Copy Link
- When implementing a custom date component,
IDate.onParamsUpdatedhas been deprecated in favour ofIDate.refresh. - When implementing a custom floating filter component,
IFloatingFilter.onParamsUpdatedhas been deprecated in favour ofIFloatingFilter.refresh.