Skip to content

Commit 8fc84eb

Browse files
docs(grid): improve first snippet
1 parent dc543c5 commit 8fc84eb

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed
6.45 KB
Loading

components/grid/overview.md

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,35 @@ To create a basic Telerik Grid:
1818
1. set its `Data` attribute to the variable that will hold your collection of data
1919
1. under its `TelerikGridColumns` tag, set the desired [`TelerikGridColumn`]({%slug components/grid/columns/bound%}) instances whose `Field` property points to the name of the model field
2020

21-
>caption Get started with a grid by providing it with a data collection
21+
>caption Get started with the grid by providing it with a data collection and enabling its key features
2222
2323
````CSHTML
2424
@using Telerik.Blazor.Components.Grid
2525
26-
<TelerikGrid Data="@MyData" Height="300px"
27-
Pageable="true" Sortable="true"
28-
FilterMode="Telerik.Blazor.FilterMode.FilterRow">
29-
<TelerikGridColumns>
30-
<TelerikGridColumn Field="@(nameof(SampleData.Id))" />
31-
<TelerikGridColumn Field="@(nameof(SampleData.Name))" Title="Employee Name" />
32-
<TelerikGridColumn Field="@(nameof(SampleData.HireDate))" Title="Hire Date" />
33-
</TelerikGridColumns>
26+
<TelerikGrid Data="@MyData" Height="400px"
27+
Pageable="true" Sortable="true" Groupable="true"
28+
FilterMode="Telerik.Blazor.FilterMode.FilterRow">
29+
<TelerikGridColumns>
30+
<TelerikGridColumn Field="@(nameof(SampleData.Id))" />
31+
<TelerikGridColumn Field="@(nameof(SampleData.Name))" Title="Employee Name" />
32+
<TelerikGridColumn Field="@(nameof(SampleData.HireDate))" Title="Hire Date" />
33+
</TelerikGridColumns>
3434
</TelerikGrid>
3535
3636
@code {
37-
public IEnumerable<SampleData> MyData = Enumerable.Range(1, 50).Select(x => new SampleData
38-
{
39-
Id = x,
40-
Name = "name " + x,
41-
HireDate = DateTime.Now.AddDays(-x)
42-
});
43-
44-
public class SampleData
45-
{
46-
public int Id { get; set; }
47-
public string Name { get; set; }
48-
public DateTime HireDate { get; set; }
49-
}
50-
51-
//in a real case, consider fetching the data in an appropriate event like OnInitializedAsync
52-
//also, consider keeping the models in dedicated locations like a shared library
53-
//this is just an example that is easy to copy and run
37+
public IEnumerable<SampleData> MyData = Enumerable.Range(1, 50).Select(x => new SampleData
38+
{
39+
Id = x,
40+
Name = "name " + x,
41+
HireDate = DateTime.Now.AddDays(-x)
42+
});
43+
44+
public class SampleData
45+
{
46+
public int Id { get; set; }
47+
public string Name { get; set; }
48+
public DateTime HireDate { get; set; }
49+
}
5450
}
5551
````
5652

0 commit comments

Comments
 (0)