Fix comportamento cambio filtro su pag 1

This commit is contained in:
Samuele Locatelli
2022-09-15 18:23:10 +02:00
parent ae39db267d
commit 191b23ee7d
3 changed files with 7 additions and 48 deletions
+2
View File
@@ -26,6 +26,7 @@ namespace MP.SPEC.Components
public async Task resetCurrPage()
{
await Task.Delay(1);
currPage = 1;
}
@@ -49,6 +50,7 @@ namespace MP.SPEC.Components
{
_numRecord = value;
reportChange();
resetCurrPage();
}
}
}
+3 -3
View File
@@ -45,13 +45,14 @@ namespace MP.SPEC.Components
{
return SelFilter.CodFlux;
}
set
{
if (!SelFilter.CodFlux.Equals(value))
{
SelFilter.CurrPage = 1;
SelFilter.CodFlux = value;
StateHasChanged();
Task.Delay(1);
reportChange();
}
}
@@ -63,7 +64,6 @@ namespace MP.SPEC.Components
{
return SelFilter.IdxMacchina;
}
set
{
if (!SelFilter.IdxMacchina.Equals(value))
@@ -133,11 +133,11 @@ namespace MP.SPEC.Components
protected async Task toggleUpdate()
{
liveUpdate = !liveUpdate;
await Task.Delay(1);
if (!liveUpdate)
{
lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
}
await Task.Delay(1);
}
#endregion Protected Methods
+2 -45
View File
@@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.SPEC.Components;
using MP.SPEC.Data;
@@ -9,36 +8,15 @@ namespace MP.SPEC.Pages
{
#region Protected Fields
#if false
protected string _selFlux = "*";
protected string _selMacchina = "*";
protected string lastUpdate = "-";
protected bool reqNew = false;
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected MpDataService MDService { get; set; }
#endif
protected DataPager pagerODL;
#endregion Protected Fields
#region Protected Properties
#if false
protected bool liveUpdate { get; set; } = true;
#endif
[Inject]
protected MessageService MsgService { get; set; }
#if false
[Inject]
protected NavigationManager NavManager { get; set; }
#endif
#endregion Protected Properties
#region Protected Methods
@@ -46,6 +24,7 @@ namespace MP.SPEC.Pages
protected void ForceReload(int newNum)
{
numRecord = newNum;
//currFilter.LiveUpdate = (currPage == 1);
}
protected void ForceReloadPage(int newNum)
@@ -75,13 +54,11 @@ namespace MP.SPEC.Pages
protected void updateTotal(int newTotCount)
{
//await Task.Delay(1);
totalCount = newTotCount;
}
#endregion Protected Methods
#region Private Fields
private int _totalCount = 0;
@@ -100,7 +77,6 @@ namespace MP.SPEC.Pages
private bool isLoading { get; set; } = false;
private int numRecord
{
get => MsgService.numRecord;
@@ -111,37 +87,18 @@ namespace MP.SPEC.Pages
{
get => _totalCount;
set => _totalCount = value;
//get => MsgService.totalCount;
//set => MsgService.totalCount = value;
}
#endregion Private Properties
#region Private Methods
#if false
private async Task reloadData()
{
isLoading = true;
await Task.Delay(1);
if (!liveUpdate)
{
lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
}
isLoading = false;
await Task.Delay(1);
}
#endif
private async Task updateFilter(SelectFluxParams newParams)
{
isLoading = true;
currFilter = newParams;
currFilter.LiveUpdate = false;
currFilter.LiveUpdate = (currPage == 1);
currPage = newParams.CurrPage;
//currFilter.LiveUpdate = !currFilter.LiveUpdate;
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
isLoading = false;