Update test paginazione

This commit is contained in:
Samuele Locatelli
2023-09-29 08:19:25 +02:00
parent c9a5c16769
commit 0c1ba8722a
2 changed files with 25 additions and 10 deletions
+24 -9
View File
@@ -9,7 +9,6 @@
<MP_TAB.Client.Components.TcHistoryFilter Title="Storico Tempi Ciclo" SearchMinChar="@SearchMinChar" E_CodArt="SelCodArt" E_IdxMacc="SelIdxMacc" MatrOpr="@MatrOpr"></MP_TAB.Client.Components.TcHistoryFilter>
</div>
<div class="card-body">
<table class="table table-striped table-sm">
<thead>
<tr>
@@ -38,7 +37,7 @@
<small class="text-secondary">@item.DescArticolo</small>
</td>
<td>
@item.Tcassegnato
<div>@item.Tcassegnato</div>
<small class="text-secondary">@item.Tcassegnato</small>
</td>
<td>@item.Note</td>
@@ -54,17 +53,18 @@
}
</tbody>
</table>
</div>
<div class="card-footer">
</div>
</div>
@code {
[Parameter]
public int MatrOpr { get; set; } = 0;
[Parameter]
public int MatrOpr { get; set; } = 0;
[Inject]
protected IConfiguration config { get; set; } = null!;
[Inject]
protected IConfiguration config { get; set; } = null!;
protected int SearchMinChar = 3;
protected string CodArt = "";
@@ -72,6 +72,11 @@
protected string BaseAddr = "";
protected bool isLoading = false;
protected int PageSize = 10;
protected int TotalCount = 0;
protected int PageNum = 1;
protected List<ODLExpModel> ListComplete { get; set; } = new List<ODLExpModel>();
protected List<ODLExpModel> ListODL { get; set; } = new List<ODLExpModel>();
protected override async Task OnInitializedAsync()
@@ -102,7 +107,17 @@
var rawData = await Http.GetFromJsonAsync<List<ODLExpModel>>(ApiUrl);
if (rawData != null)
{
ListODL = rawData;
ListComplete = rawData;
TotalCount = ListComplete.Count;
// esegue paginazione
if(TotalCount>PageSize)
{
ListODL = ListComplete.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();
}
else
{
ListODL = ListComplete;
}
}
}
catch(Exception exc)
+1 -1
View File
@@ -61,7 +61,7 @@ namespace MP.Data.Services
/// <param name="CodArt">Cod articolo</param>
/// <param name="IdxMacchina">Macchina selezionata</param>
/// <returns></returns>
public async Task<List<ODLExpModel>> ListODLFilt(string CodArt, string IdxMacchina)
public async Task<List<ODLExpModel>> ListODLFilt(string CodArt, string IdxMacchina="*")
{
// setup parametri costanti
bool inCorso = false;