|
|
|
@ -11,6 +11,7 @@ using ValblazeProject.Components;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace ValblazeProject.Pages
|
|
|
|
|
{
|
|
|
|
@ -36,28 +37,38 @@ namespace ValblazeProject.Pages
|
|
|
|
|
[CascadingParameter]
|
|
|
|
|
public IModalService Modal { get; set; }
|
|
|
|
|
|
|
|
|
|
private DataGrid<Item> dataGrid;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string _searchText;
|
|
|
|
|
|
|
|
|
|
public string SearchText
|
|
|
|
|
private int totalSizeByPage = 10;
|
|
|
|
|
|
|
|
|
|
public string search
|
|
|
|
|
{
|
|
|
|
|
get { return _searchText; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_searchText = value;
|
|
|
|
|
OnSearch(_searchText);
|
|
|
|
|
OnSearch();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task OnSearch(string _searchText)
|
|
|
|
|
public async Task OnSearch()
|
|
|
|
|
{
|
|
|
|
|
/* foreach(var item in items)
|
|
|
|
|
List<Item> maListe = await DataService.List();
|
|
|
|
|
items.Clear();
|
|
|
|
|
foreach(var item in maListe)
|
|
|
|
|
{
|
|
|
|
|
if(item.Name == rechercheText)
|
|
|
|
|
if(item.DisplayName == null || string.IsNullOrEmpty(_searchText) || item.DisplayName.Contains(_searchText))
|
|
|
|
|
{
|
|
|
|
|
rechercheItems.Add(item);
|
|
|
|
|
items.Add(item);
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
TODO
|
|
|
|
|
}
|
|
|
|
|
totalItem = items.Count;
|
|
|
|
|
int pageCourante = dataGrid.CurrentPage;
|
|
|
|
|
items = items.Skip((pageCourante - 1) * totalSizeByPage).Take(totalSizeByPage).ToList();
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -70,10 +81,18 @@ namespace ValblazeProject.Pages
|
|
|
|
|
|
|
|
|
|
if (!e.CancellationToken.IsCancellationRequested)
|
|
|
|
|
{
|
|
|
|
|
items = await DataService.List(e.Page, e.PageSize);
|
|
|
|
|
totalItem = await DataService.Count();
|
|
|
|
|
if (string.IsNullOrEmpty(_searchText))
|
|
|
|
|
{
|
|
|
|
|
items = await DataService.List(e.Page, e.PageSize);
|
|
|
|
|
totalItem = await DataService.Count();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await OnSearch();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void OnDelete(int id)
|
|
|
|
|
{
|
|
|
|
|
var parameters = new ModalParameters();
|
|
|
|
|