@page "/TEST"
@layout EmptyLayout
@* TextProperty="@(PropertyAccess.GetDynamicPropertyExpression("LastName", typeof(string)))"> *@
@string.Join(", ", columns.Where(c => c.Value == typeof(string)).Take(grid.MaxSelectedLabels).Select(c => context[c.Key]))
@foreach (var column in columns)
{
@* Property="@PropertyAccess.GetDynamicPropertyExpression(column.Key, column.Value)"> *@
@context[@column.Key]
}
@code {
RadzenDropDownDataGrid> grid;
IDictionary selectedItem;
public IEnumerable> data { get; set; }
public IDictionary columns { get; set; }
public enum EnumTest
{
EnumValue1,
EnumValue2
}
void OnChange(object value)
{
selectedItem = (IDictionary)value;
}
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
columns = new Dictionary()
{
{ "EmployeeID", typeof(int) },
{ "MyColumn", typeof(EnumTest) },
{ "FirstName", typeof(string) },
{ "LastName", typeof(string) },
{ "HireDate", typeof(DateTime) },
};
foreach (var i in Enumerable.Range(0, 50))
{
columns.Add($"Column{i}", typeof(string));
}
data = Enumerable.Range(0, 100).Select(i =>
{
var row = new Dictionary();
foreach (var column in columns)
{
row.Add(
column.Key,
column.Value == typeof(EnumTest)
? (i % 2 == 0 ? EnumTest.EnumValue1 : EnumTest.EnumValue2)
: column.Value == typeof(int)
? i
: column.Value == typeof(DateTime)
? DateTime.Now.AddMonths(i)
: $"{column.Key}{i}"
);
}
return row;
});
}
}