Correzione invio multiplo dati sul cambio pagina

This commit is contained in:
Samuele Locatelli
2021-05-24 12:23:27 +02:00
parent 360da3b658
commit caf77e316b
3 changed files with 37 additions and 8 deletions
+1 -1
View File
@@ -57,6 +57,6 @@
}
</div>
<div class="card-footer py-1">
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" />
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" />
</div>
</div>
+1 -1
View File
@@ -67,6 +67,6 @@
}
</div>
<div class="card-footer py-1">
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="@isLoading" />
</div>
</div>
+35 -6
View File
@@ -21,6 +21,10 @@ namespace MP.Stats.Pages
#region Private Properties
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
private SelectData currFilter
{
get
@@ -33,9 +37,36 @@ namespace MP.Stats.Pages
}
}
private int currPage { get; set; } = 1;
private int currPage
{
get => _currPage;
set
{
if (_currPage != value)
{
_currPage = value;
var pUpd = Task.Run(async () => await reloadData());
pUpd.Wait();
}
}
}
private bool isLoading { get; set; } = false;
private int numRecord { get; set; } = 10;
private int numRecord
{
get => _numRecord;
set
{
if (_numRecord != value)
{
_numRecord = value;
var pUpd = Task.Run(async () => await reloadData());
pUpd.Wait();
}
}
}
private bool ShowCharts { get; set; } = false;
#endregion Private Properties
@@ -91,16 +122,14 @@ namespace MP.Stats.Pages
await reloadData();
}
protected async Task ForceReload(int newNum)
protected void ForceReload(int newNum)
{
numRecord = newNum;
await reloadData();
}
protected async Task ForceReloadPage(int newNum)
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
await reloadData();
}
protected override async Task OnInitializedAsync()