mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-02 03:57:38 +08:00
feat(module: table): reload data with specific page index and size (#2072)
This commit is contained in:
parent
a05ab64035
commit
a4648d37c5
@ -6,6 +6,8 @@ namespace AntDesign
|
||||
{
|
||||
void ReloadData();
|
||||
|
||||
void ReloadData(int? pageIndex, int? pageSize = null);
|
||||
|
||||
QueryModel GetQueryModel();
|
||||
|
||||
void SetSelection(string[] keys);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
@ -134,5 +135,39 @@ namespace AntDesign
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void ChangePageSize(int pageSize)
|
||||
{
|
||||
pageSize = Math.Max(1, pageSize);
|
||||
|
||||
if (_pageSize == pageSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_pageSize = pageSize;
|
||||
|
||||
if (PageSizeChanged.HasDelegate)
|
||||
{
|
||||
PageSizeChanged.InvokeAsync(_pageSize);
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangePageIndex(int pageIndex)
|
||||
{
|
||||
pageIndex = Math.Max(1, pageIndex);
|
||||
|
||||
if (_pageIndex == pageIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_pageIndex = pageIndex;
|
||||
|
||||
if (PageIndexChanged.HasDelegate)
|
||||
{
|
||||
PageIndexChanged.InvokeAsync(_pageIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,6 +217,16 @@ namespace AntDesign
|
||||
this.ReloadAndInvokeChange();
|
||||
}
|
||||
|
||||
public void ReloadData(int? pageIndex, int? pageSize = null)
|
||||
{
|
||||
ChangePageIndex(pageIndex ?? 1);
|
||||
ChangePageSize(pageSize ?? PageSize);
|
||||
|
||||
FlushCache();
|
||||
|
||||
this.ReloadAndInvokeChange();
|
||||
}
|
||||
|
||||
public QueryModel GetQueryModel() => BuildQueryModel();
|
||||
|
||||
private QueryModel<TItem> BuildQueryModel()
|
||||
|
Loading…
Reference in New Issue
Block a user