Custom Detail

When a Master Row is expanded, the grid uses the default Detail Cell Renderer to create and display the Detail Grid inside one row of the Master Grid. You can provide a customer Detail Cell Renderer to display something else if the default Detail Cell Renderer doesn't do what you want.

Configure the grid to use a customer Detail Cell Renderer using the grid property detailCellRenderer.

gridOptions = { // normally you leave this blank, means the grid // will use the default Detail Cell Renderer detailCellRenderer: 'myCellRendererComp', // these are the parameters that will get sent to the Detail Cell Renderer, // in this case, to an instance of your MyCellRendererComp detailCellRendererParams: {...}, }

The Detail Cell Renderer should be a Cell Renderer component. See Cell Renderer on how to build and register a Cell Renderer with the grid.

The following examples demonstrate minimalist custom Detail Cell Renderer. Note that where a Detail Grid would normally appear, only the message "My Customer Detail" is shown.

Custom Detail With Form

It is not mandatory to display a grid inside the detail section. As you are providing a custom component, there are no restrictions as to what can appear inside the custom component.

This example shows a custom Detail Cell Renderer that uses a form rather than a grid.

Custom Detail With Grid

It is possible to provide a Customer Detail Grid that does a similar job to the default Detail Cell Renderer. This example demonstrates displaying a customer grid as the detail.

In order for the Detail Grid's API to be available via the Master Grid as explained in Accessing Detail Grids, a Grid Info object needs to be registered with the Master Grid.

When the Detail Grid is created, register it via masterGridApi.addDetailGridInfo() and when the Detail Grid is destroyed, unregister it via masterGridApi.removeDetailGridInfo(). A Detail ID is required when calling these methods. Any unique ID can be used, however for consistency with how the default Detail Cell Renderer works it's recommended to use the ID of the detail Row Node.

////////////////////////////// // Register with Master Grid var detailId = params.node.id; // Create Grid Info object var detailGridInfo = { id: detailId, api: params.api, columnApi: params.columnApi }; this.masterGridApi.addDetailGridInfo(detailId, detailGridInfo); ////////////////////////////// // Unregister with Master Grid this.masterGridApi.removeDetailGridInfo(detailId);