@page "/"
<h1>Hello, world!</h1>
Welcome to your new app.
<SurveyPrompt Title="How is Blazor working for you?" />
@using Syncfusion.EJ2.RazorComponents.Grids;
@using WebApplication1.Shared.Models;
@using Syncfusion.EJ2.RazorComponents.TreeGrid;
@inject HttpClient client
<EjsGrid id="Grid" ref="@grid" DataSource="@data" AllowSorting="true">
<GridColumns>
<GridColumn Field="@nameof(Employee.EmployeeID)" HeaderText="Order ID" ISPrimaryKey="true" TextAlign="@Syncfusion.EJ2.RazorComponents.Grids.TextAlign.Right" Width="90" AllowSorting="true"></GridColumn>
. . . .
<GridColumn Field="@nameof(Employee.City)" HeaderText="City" Width="150" AllowSorting="false"></GridColumn>
</GridColumns>
</EjsGrid>
@functions{
Employee[] data;
EjsGrid grid;
protected override async Task OnInitAsync()
{
this.data = await client.GetJsonAsync<Employee[]>("api/Default");
StateHasChanged();
this.grid.DataBind();
}
}
|