React Grid: Master / Detail - Other
Here we discuss areas of Master / Detail that didn't quite fit with the other sections within the documentation.
By default, the Detail Grid takes up the width of the Master Grid and does not move when the Master Grid's columns are horizontally scrolled. This is because the Detail Grid is not sitting with the other Master Grid's cells, rather it is in a separate container that overlays the Master Grid's cells and takes up with full width of the grid ignoring all the Master Grid's columns.
The underlying feature of the grid that allows the Detail Grid to span the width of the Master Grid is called Full Width Row.
It is possible to have the Detail Grid sit within the same container as the Master Grid's cells and hence move with the Master Grid's horizontal scrolling. This is achieved by 'Embedding the Full Width Row' and is set via the grid property
embedFullWidthRows=true for the Master Grid. This tells the grid to layout (embed) the Detail Panel with the other rows.
In the example below, notice that horizontal scrolling is combined for both Master Grid and Detail Grid using the Embed Full Width Rows feature.
If you are mixing Embed Full Width Rows and Custom Detail, then be aware the Detail Panel will get rendered three times as follows:
- Pinned Left Columns
- Pinned Right Columns
- Pinned Centre Columns
This is because the Columns, and thus the Detail Panel, are appearing in three separate scrollable sections. The example below demonstrates this. Note the custom Detail Panel appears in all three sections.
If you want your custom Detail Panel to only show content in one section, have logic that inspects the components
params.pinned property and renders content relevant for the section.
There are no specific configurations for filtering and sorting with Master / Detail but as there are multiple grids each grid will filter and sort independently.
Below shows a simple Master / Detail setup which has filtering and sorting enabled in both master and detail grids.
By default, exporting the master grid will just export the master rows. If you want to export detail rows, you can configure the
getCustomContentBelowRow callback to generate a representation of the detail row that will be inserted below the master rows in the in the export. See the export documentation for more details.
There is an important difference between rendering and exporting Master / Detail content. When you expand a master row in the UI, a new instance of the Grid is created to render the detail, meaning that you have the full power of the Grid to sort, filter and format the detail data.
When exporting, the original data object representing the row is passed to
getCustomContentBelowRow which returns styled content to be inserted into the export. No instance of the Grid is created. This means that export performance is good even with large Master / Detail data sets. However, if your
detailGridOptions contains value getters, value formatters, sorting, filtering etc, and you want these to appear in the export, they must be applied by
Since detail grids are full Grid instances, triggering an export through the right-click context menu on a detail grid will do a normal export for the detail grid only. If this is not appropriate for your application you can disable the export item in the context menu, or replace it with a custom item that triggers an export on the master grid.
The example below demonstrate how both master and detail data can be exported.
The Master / Detail feature organises the grid in a way which overlaps with other features. For this reason, Master / Detail does not work with certain grid configurations. These configurations are as follows:
Master / Detail is not supported with Tree Data. This is because the concept of tree data conflicts with Master / Detail, in that in tree data, any row can expand to show child rows, which would result in a clash when a row has child rows in addition to having Master / Detail at the same row.
It is not possible to mix DOM layout for master detail. This is because the layout is a CSS setting that would be inherited by all grids contained with the master grid. So if your master grid was 'for-print', then all child grids would pick up the 'for-print' layout.
When using Master / Detail and for-print, then all detail grids need to use for-print.
When using Master / Detail and auto-height, then all detail grids need to use auto-height.
When Range Selection is enabled on the Master Grid, the Detail Grid will not participate in the Range Selection of the Master Grid.