Add pagination state to Pager in Index.razor

When clicking the Roles or Edit button, returning would load the first page.
Pager now tracks and updates the current page using a new _page field and the CurrentPage/OnPageChange parameters. This improves pagination handling and user experience by persisting the current page state.
This commit is contained in:
Leigh Pointer
2025-12-15 10:21:32 +01:00
parent c418ddf240
commit b4f8896713

View File

@@ -33,7 +33,7 @@ else
</div>
<br />
<Pager Items="@users" RowClass="align-middle" SearchProperties="User.Username,User.Email,User.DisplayName">
<Pager Items="@users" CurrentPage="@_page.ToString()" OnPageChange="@((page) => _page = page)" RowClass="align-middle" SearchProperties="User.Username,User.Email,User.DisplayName">
<Header>
<th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th>
@@ -551,6 +551,7 @@ else
@code {
private List<UserRole> users;
private string _deleted = "false";
private int _page = 1;
private string _allowregistration;
private string _registerurl;