-
Notifications
You must be signed in to change notification settings - Fork 1
/
MyGrid.cs
35 lines (32 loc) · 1.13 KB
/
MyGrid.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using DevExpress.Blazor;
using DxBlazorApp.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace DxBlazorApp.Components {
public class MyGrid<T> : ComponentBase {
[Parameter]
public IEnumerable<T> Data { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter]
public Dictionary<string, object> Settings { get; set; }
protected override void BuildRenderTree(RenderTreeBuilder builder) {
builder.OpenComponent<DxGrid>(0);
builder.AddAttribute(1, "Data", (object)Data);
builder.AddAttribute(2, "Columns", ChildContent);
if (Settings != null) {
builder.AddMultipleAttributes(3, Settings);
//OR
//int seq = 3;
//foreach (var item in Settings) {
// builder.AddAttribute(seq++, item.Key, item.Value);
//}
}
builder.CloseComponent();
}
}
}