1.9 KiB
MgGrid — Columns
Part of the MgGrid system. See
README.mdfor overview and component hierarchy.
MgGridDataColumn
Extended DxGridDataColumn with InfoPanel and URL link support.
| Parameter | Type | Default | Description |
|---|---|---|---|
ShowInInfoPanel |
bool |
true |
Whether this column is visible in InfoPanel |
InfoPanelDisplayFormat |
string? |
null |
Custom display format for InfoPanel |
InfoPanelOrder |
int |
int.MaxValue |
Column order in InfoPanel (lower = earlier) |
InfoPanelEditTemplate |
RenderFragment<MgGridInfoPanelEditContext>? |
null |
Custom InfoPanel editor (edit mode) — takes precedence over the EditSettings / property-type default editors |
UrlLink |
string? |
null |
URL template with {Property} placeholders |
UrlLink example: https://admin.example.com/Entity/Edit/{Id} — renders cell as <a href="..." target="_blank">.
InfoPanelEditTemplate
Use when the grid-side editor is a CellEditTemplate the InfoPanel cannot reuse (it is bound to the grid-cell
context) — without it, the panel falls back to the property-type default editor (e.g. int → number spinner).
Context: MgGridInfoPanelEditContext(object EditModel, Action Refresh) — call Refresh() after mutations
other fields depend on (cascading lookups), it re-renders the InfoPanel.
<MgGridDataColumn FieldName="CategoryId" Caption="Category">
<CellEditTemplate>@CategoryEditor((MyItem)context.EditModel)</CellEditTemplate>
<InfoPanelEditTemplate>@CategoryEditor((MyItem)context.EditModel, context.Refresh)</InfoPanelEditTemplate>
</MgGridDataColumn>
Define the editor once as a shared fragment (private RenderFragment CategoryEditor(MyItem item, Action? refresh = null) => @<DxComboBox ...>;)
so the grid cell and the InfoPanel render the same component — no duplicated markup.
Uses compiled property accessors (ConcurrentDictionary cache) for performance.