From fd27c4247000c22c2f540d068aa0a22e91477367 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Thu, 10 Dec 2020 16:13:31 +0800 Subject: [PATCH] Added OnSearchAsync method --- .../src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs index 30a5c8ad26..16b382ecf7 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs @@ -175,7 +175,7 @@ namespace Volo.Abp.BlazoriseUI protected virtual int PageSize { get; } = LimitedResultRequestDto.DefaultMaxResultCount; - protected int CurrentPage; + protected int CurrentPage = 1; protected string CurrentSorting; protected int? TotalCount; protected TGetListInput GetListInput = new TGetListInput(); @@ -255,7 +255,7 @@ namespace Volo.Abp.BlazoriseUI if (GetListInput is IPagedResultRequest pagedResultRequestInput) { - pagedResultRequestInput.SkipCount = CurrentPage * PageSize; + pagedResultRequestInput.SkipCount = (CurrentPage - 1) * PageSize; } if (GetListInput is ILimitedResultRequest limitedResultRequestInput) @@ -266,13 +266,22 @@ namespace Volo.Abp.BlazoriseUI return Task.CompletedTask; } + protected virtual async Task OnSearchAsync() + { + CurrentPage = 1; + + await GetEntitiesAsync(); + + StateHasChanged(); + } + protected virtual async Task OnDataGridReadAsync(DataGridReadDataEventArgs e) { CurrentSorting = e.Columns .Where(c => c.Direction != SortDirection.None) .Select(c => c.Field + (c.Direction == SortDirection.Descending ? " DESC" : "")) .JoinAsString(","); - CurrentPage = e.Page - 1; + CurrentPage = e.Page; await GetEntitiesAsync();