Updated pager.

This commit is contained in:
2025-11-10 20:31:50 -05:00
parent 9cd9230cec
commit e2c39cf581
4 changed files with 77 additions and 10 deletions

View File

@@ -4,6 +4,7 @@
@using JSMR.Application.Common.Search
@using JSMR.Application.Creators.Queries.Search
@using JSMR.Application.Creators.Queries.Search.Contracts
@using JSMR.UI.Blazor.Components
@using JSMR.UI.Blazor.Services
<PageTitle>Creators</PageTitle>
@@ -39,7 +40,7 @@ else
</Columns>
</MudDataGrid>
<MudPagination ShowFirstButton="true" ShowLastButton="true" Count="@((int)Math.Ceiling((decimal)searchResults.TotalItems / (decimal)100))" @bind-Selected="@PageNumber" Class="j-pager" />
<JPagination @bind-PageNumber="PageNumber" @bind-PageSize="PageSize" @bind-TotalItems="searchResults.TotalItems" />
}
<style>
@@ -68,7 +69,7 @@ else
set
{
keywords = value;
_ = LoadTagsAsync();
_ = UpdateDataAsync(true);
}
}
@@ -80,21 +81,40 @@ else
set
{
pageNumber = value;
_ = LoadTagsAsync();
_ = UpdateDataAsync(false);
}
}
int pageSize = 100;
public int PageSize
{
get { return pageSize; }
set
{
pageSize = value;
_ = UpdateDataAsync(true);
}
}
SearchResult<CreatorSearchItem>? searchResults;
protected override Task OnInitializedAsync()
{
_ = LoadTagsAsync();
_ = LoadCreatorsAsync();
return Task.CompletedTask;
}
private async Task LoadTagsAsync()
private async Task UpdateDataAsync(bool resetPageNumber)
{
if (resetPageNumber)
pageNumber = 1;
await LoadCreatorsAsync();
}
private async Task LoadCreatorsAsync()
{
SearchCreatorsRequest request = new(
Options: new()