-
Notifications
You must be signed in to change notification settings - Fork 352
/
Copy pathGrid.razor
47 lines (42 loc) · 1.35 KB
/
Grid.razor
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
35
36
37
38
39
40
41
42
43
44
45
46
47
@page "/grid"
@using BUnit_Sample.Model
<TelerikGrid Data="@GridData"
EditMode="@GridEditMode.Inline"
Height="400px"
Pageable="true"
Sortable="true"
Reorderable="true">
<GridColumns>
<GridColumn Field=@nameof(Person.EmployeeId)>
<Template>
@{var person = context as Person; }
<span class="custom-id-@person.EmployeeId">@person.EmployeeId</span>
</Template>
</GridColumn>
<GridColumn Field=@nameof(Person.Name) />
<GridColumn Field=@nameof(Person.AgeInYears) Title="Age" />
<GridColumn Field=@nameof(Person.HireDate) Title="Hire Date" />
</GridColumns>
<DetailTemplate>
@{ var person = context as Person; }
<span>DetailTemplate for @person.Name</span>
</DetailTemplate>
</TelerikGrid>
@code {
public List<Person> GridData { get; set; }
protected override void OnInitialized()
{
GridData = new List<Person>();
var rand = new Random();
for (int i = 0; i < 100; i++)
{
GridData.Add(new Person()
{
EmployeeId = i,
Name = "Employee " + i.ToString(),
AgeInYears = i,
HireDate = new DateTime(2020, 6, 1).Date.AddDays(i)
});
}
}
}