diff --git a/Code/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 b/Code/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2
index da4e4a5..67eb224 100644
Binary files a/Code/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 and b/Code/.vs/BlazorApp/DesignTimeBuild/.dtbcache.v2 differ
diff --git a/Code/.vs/BlazorApp/FileContentIndex/0a99a780-ecbb-4e02-a14c-db5ac2d1b8ee.vsidx b/Code/.vs/BlazorApp/FileContentIndex/0a99a780-ecbb-4e02-a14c-db5ac2d1b8ee.vsidx
new file mode 100644
index 0000000..7b5e8f0
Binary files /dev/null and b/Code/.vs/BlazorApp/FileContentIndex/0a99a780-ecbb-4e02-a14c-db5ac2d1b8ee.vsidx differ
diff --git a/Code/.vs/BlazorApp/FileContentIndex/4d30ce00-d640-4b5b-a00f-fc5092ecb2a2.vsidx b/Code/.vs/BlazorApp/FileContentIndex/4d30ce00-d640-4b5b-a00f-fc5092ecb2a2.vsidx
deleted file mode 100644
index b94bbf3..0000000
Binary files a/Code/.vs/BlazorApp/FileContentIndex/4d30ce00-d640-4b5b-a00f-fc5092ecb2a2.vsidx and /dev/null differ
diff --git a/Code/.vs/BlazorApp/v17/.suo b/Code/.vs/BlazorApp/v17/.suo
index 627c05e..2a9f57c 100644
Binary files a/Code/.vs/BlazorApp/v17/.suo and b/Code/.vs/BlazorApp/v17/.suo differ
diff --git a/Code/ProjetBlazor/Pages/List.razor b/Code/ProjetBlazor/Pages/List.razor
index 6ae7066..c1cca6c 100644
--- a/Code/ProjetBlazor/Pages/List.razor
+++ b/Code/ProjetBlazor/Pages/List.razor
@@ -1,35 +1,28 @@
@page "/list"
+@using Models
List
-@if (items != null)
-{
-
-
-
- Id |
- Display Name |
- Stack Size |
- Maximum Durability |
- Enchant Categories |
- Repair With |
- Created Date |
-
-
-
- @foreach (var item in items)
- {
-
- @item.Id |
- @item.DisplayName |
- @item.StackSize |
- @item.MaxDurability |
- @(string.Join(", ", item.EnchantCategories)) |
- @(string.Join(", ", item.RepairWith)) |
- @item.CreatedDate.ToShortDateString() |
-
- }
-
-
-}
-
+
+
+
+
+
+
+
+ @(string.Join(", ", ((Item)context).EnchantCategories))
+
+
+
+
+ @(string.Join(", ", ((Item)context).RepairWith))
+
+
+
+
\ No newline at end of file
diff --git a/Code/ProjetBlazor/Pages/List.razor.cs b/Code/ProjetBlazor/Pages/List.razor.cs
index c4f7ffe..87e97a0 100644
--- a/Code/ProjetBlazor/Pages/List.razor.cs
+++ b/Code/ProjetBlazor/Pages/List.razor.cs
@@ -1,11 +1,14 @@
-using Microsoft.AspNetCore.Components;
+using Blazorise.DataGrid;
+using Microsoft.AspNetCore.Components;
using ProjetBlazor.Models;
namespace ProjetBlazor.Pages
{
public partial class List
{
- private Item[]? items;
+ private List- ? items;
+
+ private int totalItem;
[Inject]
public HttpClient? Http { get; set; }
@@ -13,11 +16,22 @@ namespace ProjetBlazor.Pages
[Inject]
public NavigationManager? NavigationManager { get; set; }
- protected override async Task OnInitializedAsync()
+ private async Task OnReadData(DataGridReadDataEventArgs
- e)
{
- items = await Http.GetFromJsonAsync
- ($"{NavigationManager.BaseUri}fake-data.json");
+ if (e.CancellationToken.IsCancellationRequested)
+ {
+ return;
+ }
+
+ // When you use a real API, we use this follow code
+ //var response = await Http.GetJsonAsync
- ( $"http://my-api/api/data?page={e.Page}&pageSize={e.PageSize}" );
+ var response = (await Http.GetFromJsonAsync
- ($"{NavigationManager.BaseUri}fake-data.json")).Skip((e.Page - 1) * e.PageSize).Take(e.PageSize).ToList();
+
+ if (!e.CancellationToken.IsCancellationRequested)
+ {
+ totalItem = (await Http.GetFromJsonAsync
>($"{NavigationManager.BaseUri}fake-data.json")).Count;
+ items = new List- (response); // an actual data for the current page
+ }
}
}
}
-
-
diff --git a/Code/ProjetBlazor/Pages/_Layout.cshtml b/Code/ProjetBlazor/Pages/_Layout.cshtml
index 5d9197d..e7f3228 100644
--- a/Code/ProjetBlazor/Pages/_Layout.cshtml
+++ b/Code/ProjetBlazor/Pages/_Layout.cshtml
@@ -28,5 +28,11 @@
+
+
+
+
+
+