Skip to main content

Overview

TeeGrid supports master-detail relationships where clicking an expand icon reveals a nested sub-grid. This works with databases, arrays, and any data source.

Basic Master-Detail

Setting Up the Master Grid

Creating the Expander

From the FireMonkey Master-Detail demo:

Providing Detail Data

Multi-Level Master-Detail

You can nest multiple levels (Customer -> Orders -> Order Details):

Complete Example

From Master_Detail_FireDAC.pas:

Key Concepts

Expander Render

The TExpanderRender displays the expand/collapse icon:

OnGetData Event

OnNewDetail Event

Called when a new detail grid is created:

Adding Totals to Detail Grids

Expand/Collapse All

Styling Detail Grids

Features

  • Multiple Levels: Nest as many levels as needed
  • Lazy Loading: Detail data loaded only when expanded
  • Automatic Cleanup: Detail grids freed when collapsed
  • Custom Styling: Each level can have different appearance
  • Totals Support: Add summary calculations to detail grids
  • Expand/Collapse All: Programmatic control

Common Patterns

Database Master-Detail

Array Master-Detail

Best Practices

  1. Set OwnsData := True so grid automatically frees detail data
  2. Use OnNewDetail to customize newly created detail grids
  3. Enable AlwaysExpand when you can’t determine if detail exists
  4. Style each level differently for visual hierarchy
  5. Add totals to detail grids for better insight

Next Steps