Core Features

Advanced Features

React Data GridLoading Cell Component

Version 36.2.0

Use a custom Loading Cell Component to replace the grid's provided loading indicators. The same component interface is used for skeleton cells in the Client-Side and Server-Side Row Models, and for full-width loading rows in the Server-Side Row Model.

For configuration and examples, see the loading guide for your row model:

Registering a Loading Cell Component Copy Link

Set loadingCellRenderer and loadingCellRendererParams on a column definition to customise its loading cells. Set them on defaultColDef to provide defaults for all columns. Individual column definitions take precedence over defaultColDef.

const [columnDefs, setColumnDefs] = useState([
    {
        field: 'athlete',
        loadingCellRenderer: CustomLoadingCellRenderer,
        loadingCellRendererParams: {
            loadingMessage: 'Loading athlete...',
        },
    },
]);

<AgGridReact columnDefs={columnDefs} />

For Server-Side Row Model full-width loading rows, configure the component on the grid options.

Loading rows are placeholders: row data is not yet available. Custom loading components should not rely on params.node.data being defined.

Component Interface Copy Link

When a custom Loading Cell Renderer Component is instantiated within the grid the following will be made available on props:

Properties available on the CustomLoadingCellRendererProps<TData = any, TContext = any> interface.

The row node.
The grid api.
Application context as set on gridOptions.context.

Dynamic Loading Row Selection Copy Link

Use loadingCellRendererSelector to choose a loading component at runtime. Return the component and any additional parameters, or undefined to fall back to the configured loading component.

loadingCellRendererSelector: (params) => {
    const useCustomRenderer = ...some condition/check...
    if (useCustomRenderer) {
        return {
            component: CustomLoadingCellRenderer,
            params: {
                // parameters to supply to the custom loading cell renderer
                loadingMessage: '--- CUSTOM LOADING MESSAGE ---',
            },
        };
    }
    // Use the configured loading cell renderer.
    return undefined;
}

Full Width Loading Row Copy Link

See Full Width Loading Row for the Server-Side Row Model example.

Failed Loading Copy Link

See Failed Loading for handling datasource failures in a custom loading component.

Skeleton Loading Copy Link

See Custom Loading Cells for the Client-Side Row Model, or Skeleton Loading for the Server-Side Row Model.