870 B
870 B
MgGrid — Master-Detail
Part of the MgGrid system. See
README.mdfor overview and component hierarchy.
How It Works
MgGridBase.BuildRenderTreewraps content inCascadingValue<IMgGridBase>- Child grids receive this via
[CascadingParameter] IMgGridBase? ParentGrid IsMasterGrid=ParentDataItem == nullGetRootGrid()walks theParentGridchain to find the topmost grid
Detail Grid Setup
<DetailRowTemplate>
@{
var parent = (ParentEntity)context.DataItem;
<GridChildEntity ParentDataItem="@parent"
KeyFieldNameToParentId="ParentEntityId"
ContextIds="@(new object[] { parent.Id })" />
}
</DetailRowTemplate>
When ParentDataItem is set and KeyFieldNameToParentId is provided, new items automatically get their parent FK set via reflection.