Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
92 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
@page "/datagrid-loaddata" | ||
@using NorthwindBlazor.Data | ||
@using NorthwindBlazor.Models.Northwind | ||
|
||
@inject NorthwindContext dbContext | ||
|
||
<h1 style="display:inline">DataGrid</h1><a style="margin-left: 10px" href="https://github.com/akorchev/blazor.radzen.com/blob/master/Pages/DataGridLoadDataPage.razor" target="_blank">[source code]</a><a style="margin-left: 10px" href="https://www.radzen.com/documentation/blazor/datagrid/" target="_blank">[documentation]</a> | ||
|
||
<p>This page demonstrates <b>DataGrid</b> component bound using LoadData event. This technique can be used to populate data from external source like service.</p> | ||
|
||
<RadzenGrid Count="@count" Data="@employees" LoadData="@LoadData" AllowPaging="true" PageSize="4" TItem="Employee" ColumnWidth="200px"> | ||
<Columns> | ||
<RadzenGridColumn TItem="Employee" Property="EmployeeID" Title="Employee ID" /> | ||
<RadzenGridColumn TItem="Employee" Property="Photo" Title="Photo" Sortable="false" Filterable="false"> | ||
<Template Context="data"> | ||
<RadzenImage Path="@data?.Photo" /> | ||
</Template> | ||
</RadzenGridColumn> | ||
<RadzenGridColumn TItem="Employee" Property="LastName" Title="Last Name" /> | ||
<RadzenGridColumn TItem="Employee" Property="FirstName" Title="First Name" /> | ||
<RadzenGridColumn TItem="Employee" Property="Title" Title="Title" /> | ||
<RadzenGridColumn TItem="Employee" Property="TitleOfCourtesy" Title="Title Of Courtesy" /> | ||
<RadzenGridColumn TItem="Employee" Property="BirthDate" Title="Birth Date"> | ||
<Template Context="data"> | ||
@String.Format("{0:d}", data.BirthDate) | ||
</Template> | ||
</RadzenGridColumn> | ||
<RadzenGridColumn TItem="Employee" Property="HireDate" Title="Hire Date"> | ||
<Template Context="data"> | ||
@String.Format("{0:d}", data.HireDate) | ||
</Template> | ||
</RadzenGridColumn> | ||
<RadzenGridColumn TItem="Employee" Property="Address" Title="Address" /> | ||
<RadzenGridColumn TItem="Employee" Property="City" Title="City" /> | ||
<RadzenGridColumn TItem="Employee" Property="Region" Title="Region" /> | ||
<RadzenGridColumn TItem="Employee" Property="PostalCode" Title="Postal Code" /> | ||
<RadzenGridColumn TItem="Employee" Property="Country" Title="Country" /> | ||
<RadzenGridColumn TItem="Employee" Property="HomePhone" Title="Home Phone" /> | ||
<RadzenGridColumn TItem="Employee" Property="Extension" Title="Extension" /> | ||
<RadzenGridColumn TItem="Employee" Property="Notes" Title="Notes" /> | ||
</Columns> | ||
</RadzenGrid> | ||
|
||
@code { | ||
int count; | ||
IEnumerable<Employee> employees; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
count = await Task.FromResult(dbContext.Employees.Count()); | ||
} | ||
|
||
private async void LoadData(LoadDataArgs args) | ||
{ | ||
employees = await Task.FromResult(dbContext.Employees.Skip(args.Skip.Value).Take(args.Top.Value)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters