Browse Source

Merge pull request #6570 from abpframework/liangshiwei/blazorise-patch-1

Added OnSearchAsync method to AbpCrudPageBase
pull/6578/head
Halil İbrahim Kalkan 6 years ago
committed by GitHub
parent
commit
adab70f741
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

15
framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

@ -175,7 +175,7 @@ namespace Volo.Abp.BlazoriseUI
protected virtual int PageSize { get; } = LimitedResultRequestDto.DefaultMaxResultCount; protected virtual int PageSize { get; } = LimitedResultRequestDto.DefaultMaxResultCount;
protected int CurrentPage; protected int CurrentPage = 1;
protected string CurrentSorting; protected string CurrentSorting;
protected int? TotalCount; protected int? TotalCount;
protected TGetListInput GetListInput = new TGetListInput(); protected TGetListInput GetListInput = new TGetListInput();
@ -255,7 +255,7 @@ namespace Volo.Abp.BlazoriseUI
if (GetListInput is IPagedResultRequest pagedResultRequestInput) if (GetListInput is IPagedResultRequest pagedResultRequestInput)
{ {
pagedResultRequestInput.SkipCount = CurrentPage * PageSize; pagedResultRequestInput.SkipCount = (CurrentPage - 1) * PageSize;
} }
if (GetListInput is ILimitedResultRequest limitedResultRequestInput) if (GetListInput is ILimitedResultRequest limitedResultRequestInput)
@ -266,13 +266,22 @@ namespace Volo.Abp.BlazoriseUI
return Task.CompletedTask; return Task.CompletedTask;
} }
protected virtual async Task OnSearchAsync()
{
CurrentPage = 1;
await GetEntitiesAsync();
StateHasChanged();
}
protected virtual async Task OnDataGridReadAsync(DataGridReadDataEventArgs<TListViewModel> e) protected virtual async Task OnDataGridReadAsync(DataGridReadDataEventArgs<TListViewModel> e)
{ {
CurrentSorting = e.Columns CurrentSorting = e.Columns
.Where(c => c.Direction != SortDirection.None) .Where(c => c.Direction != SortDirection.None)
.Select(c => c.Field + (c.Direction == SortDirection.Descending ? " DESC" : "")) .Select(c => c.Field + (c.Direction == SortDirection.Descending ? " DESC" : ""))
.JoinAsString(","); .JoinAsString(",");
CurrentPage = e.Page - 1; CurrentPage = e.Page;
await GetEntitiesAsync(); await GetEntitiesAsync();

Loading…
Cancel
Save