Angular Data GridLoading Cell Renderer
angular logo

Loading cell renderers allow you to add your own loading renderers to AG Grid. Use these when the provided loading renderers do not meet your requirements.

The loading cell renderer is only used with the Server-Side Row Model. To customise the Loading Overlay used with the Client-Side Row Model, see the Overlay Component section.

Example: Custom Loading Cell Renderer

The example below demonstrates how to provide custom loading cell renderer component to the grid. Notice the following:

  • Custom Loading Cell Renderer is supplied by name via gridOptions.loadingCellRenderer.
  • Custom Loading Cell Renderer Parameters are supplied using gridOptions.loadingCellRendererParams.
  • Example simulates a long delay to display the spinner clearly.
  • Scrolling the grid will request more rows and again display the loading cell renderer.

Implementing a Loading Cell Renderer Component

The interface for the loading cell renderer component is as follows:

interface ILoadingCellRendererAngularComp {

    // Mandatory - The agInit(params) method is called on the loading cell renderer once.
    agInit(params: ILoadingCellRendererParams): void;
}

The agInit(params) method takes a params object with the items listed below:

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

Dynamic Cell Loading Renderer

It's possible to determine what Loading Cell Renderer to use dynamically - i.e. at runtime. This requires providing a loadingCellRendererSelector.

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 ---',
            },
        };
        } else {
            // no loading cell renderer 
            return undefined;
        }
    }
}

Registering Loading Cell Renderer Components

See the section registering custom components for details on registering and using custom loading cell renderers.