Skip to content

Commit c32e065

Browse files
authored
Grid overview examples (#3155)
* chore: replace example with live example url * chore: add live examples to overview page
1 parent c2e2f6c commit c32e065

File tree

1 file changed

+2
-85
lines changed

1 file changed

+2
-85
lines changed

components/grid/overview.md

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -29,56 +29,7 @@ The Telerik Blazor grid is built on native Blazor from the ground up, by a compa
2929

3030
>caption Get started with the Blazor Grid
3131
32-
````RAZOR
33-
@* Telerik Blazor Grid with some common features *@
34-
35-
<TelerikGrid Data="@GridData"
36-
Pageable="true"
37-
Sortable="true"
38-
FilterMode="@GridFilterMode.FilterRow">
39-
<GridColumns>
40-
<GridColumn Field="Name" Title="Product Name" />
41-
<GridColumn Field="Price" DisplayFormat="{0:C2}" />
42-
<GridColumn Field="@nameof(Product.Released)" DisplayFormat="{0:D}" />
43-
<GridColumn Field="@nameof(Product.Discontinued)" />
44-
</GridColumns>
45-
</TelerikGrid>
46-
47-
@code {
48-
private List<Product> GridData { get; set; }
49-
50-
protected override void OnInitialized()
51-
{
52-
GridData = new List<Product>();
53-
54-
var rnd = new Random();
55-
56-
for (int i = 1; i <= 30; i++)
57-
{
58-
GridData.Add(new Product
59-
{
60-
Id = i,
61-
Name = "Product name " + i,
62-
Price = (decimal)(rnd.Next(1, 50) * 3.14),
63-
Released = DateTime.Now.AddDays(-rnd.Next(1, 365)).AddYears(-rnd.Next(1, 10)).Date,
64-
Discontinued = i % 5 == 0
65-
});
66-
67-
}
68-
69-
base.OnInitialized();
70-
}
71-
72-
public class Product
73-
{
74-
public int Id { get; set; }
75-
public string Name { get; set; }
76-
public decimal Price { get; set; }
77-
public DateTime Released { get; set; }
78-
public bool Discontinued { get; set; }
79-
}
80-
}
81-
````
32+
<demo metaUrl="client/grid/overview/" height="555"></demo>
8233

8334
## Blazor Grid Video Tutorial
8435

@@ -186,41 +137,7 @@ To execute these methods, obtain reference to the Grid instance via `@ref`.
186137

187138
>caption How to obtain a Grid reference and call methods
188139
189-
````RAZOR
190-
<TelerikButton OnClick="@AutoFit">Autofit All Columns</TelerikButton>
191-
192-
<TelerikGrid @ref="TheGrid"
193-
Data="@GridData"
194-
Width="600px">
195-
<GridColumns>
196-
<GridColumn Field="@(nameof(GridModel.Id))" />
197-
<GridColumn Field="@(nameof(GridModel.Text))" Width="300px" />
198-
</GridColumns>
199-
</TelerikGrid>
200-
201-
@code {
202-
private TelerikGrid<GridModel> TheGrid { get; set; }
203-
204-
private async Task AutoFit()
205-
{
206-
await TheGrid.AutoFitAllColumnsAsync();
207-
}
208-
209-
private IEnumerable<GridModel> GridData = Enumerable.Range(1, 5)
210-
.Select(x => new GridModel
211-
{
212-
Id = x,
213-
Text = "some longer text here that will not fit on a single line and we would like to expand it " + x
214-
});
215-
216-
public class GridModel
217-
{
218-
public int Id { get; set; }
219-
public string Text { get; set; }
220-
}
221-
}
222-
````
223-
140+
<demo metaUrl="client/grid/overview-ref/" height="450"></demo>
224141

225142
## Next Steps
226143

0 commit comments

Comments
 (0)