Fix refresh display selezione tendina

This commit is contained in:
Samuele Locatelli
2023-04-27 17:29:28 +02:00
parent d7621a2639
commit 196869d631
2 changed files with 15 additions and 3 deletions
@@ -1,4 +1,4 @@
@if (currVal == null)
@if (currVal == null || isLoading)
{
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
}
@@ -49,7 +49,7 @@ else
<span>Template</span>
</div>
@if (listValuesFiles != null && listValuesFiles.Count > 0)
@if (listValuesFiles != null && listValuesFiles.Count > 0 && !string.IsNullOrEmpty(templateName))
{
<select class="col-7" @bind="@templateName">
@foreach (var val in listValuesFiles)
@@ -71,7 +71,7 @@ else
@foreach (var item in currVal)
{
@if (item.Key != "Folder" && item.Key != "Template")
@if (item.Key != "Folder" && item.Key != "template")
{
@if (isCombo(item.Key))
{
@@ -254,8 +254,14 @@ namespace WebDoorCreator.UI.Components.Hardware
await ReloadData(isFirst);
}
protected bool isLoading { get; set; } = false;
private async Task ReloadData(bool isFirst)
{
isLoading = true;
await Task.Delay(1);
listValuesFiles = null;
templateName = "";
var tempListVal = await WDCService.ListValuesGetAll(HwCode, "Folder");
if (tempListVal != null)
{
@@ -271,9 +277,15 @@ namespace WebDoorCreator.UI.Components.Hardware
if (tempListFiles != null)
{
listValuesFiles = tempListFiles.Where(x => x.Value.Contains(folderName)).ToList();
if (listValuesFiles != null && listValuesFiles.Count > 0)
{
templateName = listValuesFiles.FirstOrDefault()?.Label!;
}
}
}
}
isLoading = false;
await InvokeAsync(StateHasChanged);
}
#endregion Private Methods