AG Grid Enterprise: Advanced Data Grid Component
raw JSON →AG Grid Enterprise is the commercial, feature-rich version of the AG Grid data table component, offering advanced functionalities beyond the community edition such as row grouping, aggregation, master/detail views, server-side row model, integrated charts, and more complex data management capabilities. The current stable version is 35.2.1, with frequent minor releases (typically monthly or bi-monthly) and major version updates occurring approximately once a year. It distinguishes itself from other data grids through its highly performant rendering engine, extensive configurability, and comprehensive feature set, making it suitable for complex enterprise applications requiring sophisticated data manipulation and visualization. It supports integration with JavaScript, TypeScript, React, Angular, and Vue. Notably, a commercial license is required for its use, differentiating it from purely open-source alternatives.
Common errors
error AG Grid: License Key not found. Please contact AG-Grid to get a licence key. ↓
LicenseManager.setLicenseKey('YOUR_LICENSE_KEY_HERE') once in your application's entry point, replacing 'YOUR_LICENSE_KEY_HERE' with your actual license key. Ensure this happens before any grid components are rendered. error AG Grid: unable to find 'RowGroupingModule'. Please check that you are importing the module and it has been provided to the grid. ↓
import 'ag-grid-enterprise'; to your application's main entry file or before any grid components are initialized. This registers all necessary enterprise modules. error Property 'gridApi' does not exist on type 'never'. ↓
useRef hook correctly: const gridRef = useRef<AgGridReact>(null); and access gridRef.current.api after the grid is initialized, typically within a onGridReady callback. error Module not found: Error: Can't resolve 'ag-grid-community/styles/ag-grid.css' ↓
ag-grid-community is installed (npm install ag-grid-community) and verify the CSS import paths. They typically are ag-grid-community/styles/ag-grid.css and ag-grid-community/styles/ag-theme-YOURTHEME.css. Warnings
breaking AG Grid Enterprise requires a commercial license for production use. Running without a valid license will result in a watermark and 'AG Grid: License Key not found' warnings in the console. ↓
gotcha Enterprise features will not activate even with a license key if the 'ag-grid-enterprise' module is not explicitly imported. This is a common oversight. ↓
breaking Major version upgrades (e.g., v34 to v35) often introduce breaking changes, requiring updates to API usage, component imports, or theme configurations. Always consult the official changelog and migration guide. ↓
gotcha AG Grid's styling requires specific CSS files to be imported. Forgetting these or importing them incorrectly will result in an unstyled or poorly rendered grid. ↓
gotcha When using framework-specific components (e.g., AgGridReact, AgGridAngular), ensure the corresponding framework package (`ag-grid-react`, `ag-grid-angular`, `ag-grid-vue`) is installed alongside `ag-grid-community` and `ag-grid-enterprise`. ↓
Install
npm install ag-grid-enterprise yarn add ag-grid-enterprise pnpm add ag-grid-enterprise Imports
- AgGridReact wrong
import AgGridReact from 'ag-grid-react';correctimport { AgGridReact } from 'ag-grid-react'; - LicenseManager wrong
import LicenseManager from 'ag-grid-enterprise';correctimport { LicenseManager } from 'ag-grid-enterprise'; - Enterprise Modules (side-effect import) wrong
require('ag-grid-enterprise');correctimport 'ag-grid-enterprise'; - GridOptions, ColDef (TypeScript types) wrong
import { GridOptions, ColDef } from 'ag-grid-enterprise';correctimport { GridOptions, ColDef } from 'ag-grid-community';
Quickstart
import React, { useState, useRef, useEffect, useMemo, useCallback } from 'react';
import { createRoot } from 'react-dom/client';
import { AgGridReact } from 'ag-grid-react';
import { LicenseManager, ClientSideRowModelModule } from 'ag-grid-enterprise';
import 'ag-grid-community/styles/ag-grid.css'; // Core grid CSS
import 'ag-grid-community/styles/ag-theme-quartz.css'; // Theme CSS
import 'ag-grid-enterprise'; // Import enterprise modules
const AG_GRID_LICENSE_KEY = process.env.AG_GRID_LICENSE_KEY || 'YOUR_LICENSE_KEY_HERE';
const GridExample = () => {
const gridRef = useRef();
const [rowData, setRowData] = useState([
{ make: 'Tesla', model: 'Model Y', price: 64950, electric: true },
{ make: 'Ford', model: 'F-Series', price: 33850, electric: false },
{ make: 'Porsche', model: 'Taycan', price: 83600, electric: true },
{ make: 'Mercedes', model: 'EQA', price: 48890, electric: true },
{ make: 'Nissan', model: 'Leaf', price: 29800, electric: true }
]);
const [colDefs, setColDefs] = useState([
{ field: 'make', rowGroup: true }, // Example of an enterprise feature: Row Grouping
{ field: 'model' },
{ field: 'price', aggFunc: 'sum' }, // Example of an enterprise feature: Aggregation
{ field: 'electric' }
]);
// Default column properties for aggregation
const defaultColDef = useMemo(() => {
return {
flex: 1,
filter: true,
floatingFilter: true,
sortable: true,
enableValue: true, // Enable aggregation for value columns
enableRowGroup: true, // Enable row grouping
enablePivot: true // Enable pivoting
};
}, []);
useEffect(() => {
if (AG_GRID_LICENSE_KEY && AG_GRID_LICENSE_KEY !== 'YOUR_LICENSE_KEY_HERE') {
LicenseManager.setLicenseKey(AG_GRID_LICENSE_KEY);
console.log('AG Grid License Key set successfully.');
} else {
console.warn('AG Grid License Key is not set. Using trial mode.');
}
}, []);
return (
<div className={"ag-theme-quartz"} style={{ width: '100%', height: '500px' }}>
<AgGridReact
ref={gridRef}
rowData={rowData}
columnDefs={colDefs}
defaultColDef={defaultColDef}
enableRangeSelection={true} // Another enterprise feature
rowGroupPanelShow={'always'} // Show row grouping panel
pagination={true}
/>
</div>
);
};
const container = document.getElementById('root');
if (container) {
const root = createRoot(container);
root.render(<GridExample />);
} else {
console.error("Root element 'root' not found.");
}