diff --git a/docs/en/Tutorials/Part-2.md b/docs/en/Tutorials/Part-2.md index 7bc42b1fc9..1a1d29f7d1 100644 --- a/docs/en/Tutorials/Part-2.md +++ b/docs/en/Tutorials/Part-2.md @@ -604,6 +604,7 @@ Open the `Books.razor` and replace the content as the following: diff --git a/docs/en/Tutorials/Part-3.md b/docs/en/Tutorials/Part-3.md index 2106e82069..486475ff9d 100644 --- a/docs/en/Tutorials/Part-3.md +++ b/docs/en/Tutorials/Part-3.md @@ -1429,6 +1429,7 @@ Here the complete code to create the book management CRUD page, that has been de diff --git a/docs/en/Tutorials/Part-9.md b/docs/en/Tutorials/Part-9.md index 65a59f39e1..b8b198f9dc 100644 --- a/docs/en/Tutorials/Part-9.md +++ b/docs/en/Tutorials/Part-9.md @@ -868,6 +868,7 @@ Create a new Razor Component Page, `/Pages/Authors.razor`, in the `Acme.BookStor diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs index 30a5c8ad26..612034af19 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 SearchEntitiesAsync() + { + 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(); diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs index d75133cb07..0d44fd1249 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore private readonly IDbContextProvider _dbContextProvider; private readonly Lazy> _entityOptionsLazy; - protected virtual IGuidGenerator GuidGenerator { get; set; } + public virtual IGuidGenerator GuidGenerator { get; set; } public EfCoreRepository(IDbContextProvider dbContextProvider) {