Master Detail Grids
Summary
One of the most powerful features in AG Grid are Master Detail Grids.
These are grids where each row in the Master Grid can be expanded to display a Details grid.
AdapTable fully supports (and extends) AG Grid Master Detail grids.
It does so via a dedicated Plugin which provides extra features.
Primarily it enables all Detail Grids to share common AdapTable objects (e.g. Reports or Format Columns).
Installing Master Detail Plugin
Caution
- If using CommonJS, then install
@adaptabletools/adaptable-plugin-master-detail-aggrid-cjsinstead - Make sure also to include your License Key in the
DetailOptionsgrid you provide
Unlike with Row Grouping, the Details Grid is a totally separate, fully configurable AdapTable instance.
Note
Each Details Grid contains its own set of columns and own unique data
This allows you essentially to provide 2 definitions:
- the main Master Grid which provides the top level of rows
- the Details Grid which will appear when a Master row is expanded
Deep Dive
Providing Details Grid Definition
It is possible to create a second Master / Detail grid as the child of an initial Master / Details grid.
Caution
Only one level of nesting Master / Details grids is possible
- This demo illustrates how to use Master Detail Grids in AdapTable
- The Master and Detail grids have different AdapTable configurations
- However each Detail Grids shares the same Column Formatting on the
GitHub Starscolumn
Expand to see how the Master Detail Grid was configured
Create a Format Column in one Details Grid and see it applied in the other 2
Initialising the Details Grid
AdapTable provides an onDetailInit property.
This contains a function that is invoked when a Details Grid is initialised.
Hint
You can use this property to provide bespoke configuration for the Details Grid at run-time
Deep Dive
onDetailInit property
- This demo illustrates how to use
onDetailInitto configure the Detail Grids in Master Detail Grids - The function calls the AdapTable API to close the Tool Panel (SideBar) in the Details Grid when it opens - but only if the
Languageis "JavaScript" or "TypeScript"
Expand to see how onDetailInit was used
Master Detail Plugin Options
| Property | Description |
|---|---|
| detailAdaptableOptions | AdaptableOptions used in Detail Grids; all share same behaviour & State |
| onDetailInit | Function called when a Detail Grid is initialised, receives context including Adaptable Api |
FAQ
I cannot export the Master-Details Grid? That is by design; Master-Detail Grids cannot be exported as a single export since the Detail "Grids" can be anything at all (however each Grid can be exported separately)