I have created a custom model where I added an ExpandoObject and a couple properties to it. The Grid seems to render the data successfully but the data operations are not possible - the nested properties are treated as invalid. Please add support for nested ExpandoObject properties in custom models.
---
ADMIN EDIT
---
For the time being, there is a workaround that you may try. Use the ExpandoObject directly, do not nest it in the custom model - bind the Grid Data to a collection of ExpandoObject and populate its properties in the OnInitialized.
@using System.Dynamic
<TelerikGrid Data="@Data"
Pageable="true" Sortable="true" Groupable="true"
FilterMode="Telerik.Blazor.GridFilterMode.FilterRow"
EditMode="@GridEditMode.Incell"
Resizable="true" Reorderable="true">
<GridColumns>
<GridColumn Field="Id" FieldType="typeof(string)" Width="120px" />
<GridColumn Field="DetailData.PropertyInt" Title="Column A" FieldType="@typeof(int)" />
<GridColumn Field="DetailData.ProptertyString" Title="Column B" FieldType="@typeof(string)"/>
<GridColumn Field="DetailData.PropertyDate" Title="Column C" FieldType="@typeof(DateTime)"/>
</GridColumns>
</TelerikGrid>
@code {
public ExpandoObject[] Data { get; set; } = Array.Empty<ExpandoObject>();
protected override async Task OnInitializedAsync()
{
Data = new ExpandoObject[]
{
GetPopulatedExpando(1),
GetPopulatedExpando(2),
GetPopulatedExpando(3),
GetPopulatedExpando(4),
GetPopulatedExpando(5),
};
}
private ExpandoObject GetPopulatedExpando(int id)
{
dynamic expando = new ExpandoObject();
expando.Id = id;
dynamic nested = new ExpandoObject();
nested.PropertyInt = id;
nested.ProptertyString = "ID " + id;
nested.PropertyDate = new DateTime(2022, 4, id);
expando.DetailData = nested;
return expando;
}
}