You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.4 KiB
54 lines
1.4 KiB
using BlazorApp1.Components;
|
|
using BlazorApp1.Models;
|
|
using Blazorise.DataGrid;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.Extensions.Localization;
|
|
|
|
namespace BlazorApp1.Pages
|
|
{
|
|
public partial class Inventory
|
|
{
|
|
[Inject]
|
|
public IDataService DataService { get; set; }
|
|
|
|
private int totalItem;
|
|
public List<Item> Items { get; set; } = new List<Item>();
|
|
|
|
[Inject]
|
|
public IStringLocalizer<Inventory> Localizer { get; set; }
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
base.OnAfterRenderAsync(firstRender);
|
|
|
|
if (!firstRender)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Items = await DataService.List(0, await DataService.Count());
|
|
|
|
StateHasChanged();
|
|
}
|
|
private async Task OnReadData(DataGridReadDataEventArgs<Item> e)
|
|
{
|
|
if (e.CancellationToken.IsCancellationRequested)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!e.CancellationToken.IsCancellationRequested)
|
|
{
|
|
Items = await DataService.List(e.Page, e.PageSize);
|
|
totalItem = await DataService.Count();
|
|
}
|
|
}
|
|
private List<Item> SortItem()
|
|
{
|
|
List<Item> ListeOrder = new List<Item>();
|
|
ListeOrder = (List<Item>)ListeOrder.OrderBy(Item => Item.DisplayName);
|
|
return ListeOrder;
|
|
}
|
|
}
|
|
}
|