5d72d21fb1
Update gestione paginazione (visibile solo dove serve) + fix calcolo di alcuni intems male filtrati
82 lines
1.9 KiB
C#
82 lines
1.9 KiB
C#
using LiMan.DB.DTO;
|
|
using Microsoft.AspNetCore.Components;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LiMan.UI.Components
|
|
{
|
|
public partial class ListDevicesDTO
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public EventCallback<Core.Enum.UpdStatus> EC_StatusReq { get; set; }
|
|
|
|
[Parameter]
|
|
public List<DeviceDTO> SearchRecord { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public string Title { get; set; } = "Updaters List";
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected void setNumPage(int newNum)
|
|
{
|
|
currPage = newNum;
|
|
ReloadData();
|
|
isLoading = false;
|
|
}
|
|
|
|
protected void setNumRec(int newNum)
|
|
{
|
|
currPage = 1;
|
|
numRecord = newNum;
|
|
ReloadData();
|
|
isLoading = false;
|
|
}
|
|
|
|
protected async Task ShowDetail(Core.Enum.UpdStatus status)
|
|
{
|
|
await EC_StatusReq.InvokeAsync(status);
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
ReloadData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private int currPage = 1;
|
|
private bool isLoading = false;
|
|
private int numRecord = 10;
|
|
private int totalCount = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private List<DeviceDTO> ListRecord { get; set; } = new List<DeviceDTO>();
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void ReloadData()
|
|
{
|
|
totalCount = SearchRecord.Count;
|
|
// paginazione
|
|
ListRecord = SearchRecord
|
|
.Skip((currPage - 1) * numRecord)
|
|
.Take(numRecord)
|
|
.ToList();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |