Update scarti x nuovo datapager

This commit is contained in:
Samuele Locatelli
2021-05-19 18:48:24 +02:00
parent a758b0f95e
commit e016aeaf02
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -70,6 +70,6 @@
}
</div>
<div class="card-footer py-1">
<DataPager numRecord="@numRecord" numRecordChanged="ForceReload" totalCount="@SearchRecords.Count()" />
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@SearchRecords.Count()" />
</div>
</div>
+8 -1
View File
@@ -23,6 +23,7 @@ namespace MP.Stats.Pages
#region Private Properties
private SelectData currFilter { get; set; } = new SelectData();
private int currPage { get; set; } = 1;
private int numRecord { get; set; } = 10;
#endregion Private Properties
@@ -48,7 +49,7 @@ namespace MP.Stats.Pages
private async Task reloadData()
{
SearchRecords = await StatService.StatScartiGetAll(currFilter.DateStart, currFilter.DateEnd, currFilter.IdxMacchina, currFilter.IdxOdl, currFilter.KeyRichiesta, currFilter.CodArticolo, MessageService.SearchVal);
ListRecords = SearchRecords.Take(numRecord).ToArray();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToArray();
}
#endregion Private Methods
@@ -67,6 +68,12 @@ namespace MP.Stats.Pages
await reloadData();
}
protected async Task ForceReloadPage(int newNum)
{
currPage = newNum;
await reloadData();
}
protected override async Task OnInitializedAsync()
{
MessageService.ShowSearch = true;