Master-detail grids allow you to display hierarchical data where each row can expand to show a detailed view with a nested grid. This is an Enterprise feature.
Overview
The master-detail feature enables:- Expandable rows - Click to expand and show detailed information
- Nested grids - Each detail view contains a fully functional grid
- Independent configuration - Detail grids can have different column definitions
- Data relationships - Display related data in a hierarchical structure
Use Cases
- Order details within a customer list
- Call records for phone accounts
- Transaction history for accounts
- Product variants within product listings
Basic Master-Detail Implementation
Key Configuration Options
Enable Master-Detail
Set themasterDetail property to true:
Group Cell Renderer
The first column needs the group cell renderer to show expand/collapse icons:Detail Grid Configuration
Configure the detail grid throughdetailCellRendererParams:
Data Structure
Master-detail requires properly structured hierarchical data:Advanced Features
- Programmatic Expansion
- Dynamic Detail Height
- Conditional Detail Display
- Refresh Detail Data
Control row expansion programmatically:
Master-Detail with Different Features
Detail grids can have completely different configurations:Required Modules
Master-detail requires specific Enterprise modules:Master-Detail is an Enterprise feature and requires an AG Grid Enterprise license.
Best Practices
- Use type safety - Define interfaces for both master and detail data
- Set appropriate heights - Use
getDetailRowHeightfor dynamic sizing - Limit initial expansion - Don’t expand all rows by default for large datasets
- Configure independently - Detail grids can have different column definitions and features
- Handle loading states - Show loading indicators when fetching detail data
- Memory management - Consider limiting the number of simultaneously expanded rows
Common Patterns
Fetching Detail Data on Demand
Nested Master-Detail
You can nest master-detail grids multiple levels deep:Next Steps
- Explore row grouping for alternative hierarchical views
- Learn about integrated charts
- Add custom detail renderers