Pager OnPageSizeChanged method bug #406

Closed
opened 2026-01-29 17:36:46 +00:00 by claunia · 2 comments
Owner

Originally created by @compassalex on GitHub (May 11, 2022).

Describe the bug
When using the PageSizeOptions and you have a Count that is able to be shown all on one page and you switch to a page size that doesn't fit all the records on one page, the page number changes to the last page rather than staying on the first page as expected.

To Reproduce

  1. Create a blazor .net 6 project with all the default options, perform the initial Radzen set up and replace the contents of Index.razor with the below.
    @page "/"

Index

@code{
private List _words = new()
{
"1", "2", "3", "4", "5"
};
private int[] _pageSizes = new int[] { 10, 2 };
}

  1. Change the page size from 10 to 2 and it will change the page number to 3 (last page)

Expected behavior
I think the page index should not change from 0 when performing this action

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows
  • Browser Edge
  • Version 101

Additional context
Having looked at the OnPageSizeChanged method - https://github.com/radzenhq/radzen-blazor/blob/master/Radzen.Blazor/RadzenPager.razor.cs

I think the
if (isLastPage)
check should change to
if (isLastPage && !isFirstPage)

Originally created by @compassalex on GitHub (May 11, 2022). **Describe the bug** When using the PageSizeOptions and you have a Count that is able to be shown all on one page and you switch to a page size that doesn't fit all the records on one page, the page number changes to the last page rather than staying on the first page as expected. **To Reproduce** 1. Create a blazor .net 6 project with all the default options, perform the initial Radzen set up and replace the contents of Index.razor with the below. @page "/" <PageTitle>Index</PageTitle> <RadzenPager Count="_words.Count" PageSizeOptions="_pageSizes" /> @code{ private List<string> _words = new() { "1", "2", "3", "4", "5" }; private int[] _pageSizes = new int[] { 10, 2 }; } 2. Change the page size from 10 to 2 and it will change the page number to 3 (last page) **Expected behavior** I think the page index should not change from 0 when performing this action **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: Windows - Browser Edge - Version 101 **Additional context** Having looked at the OnPageSizeChanged method - https://github.com/radzenhq/radzen-blazor/blob/master/Radzen.Blazor/RadzenPager.razor.cs I think the if (isLastPage) check should change to if (isLastPage && !isFirstPage)
Author
Owner

@seljmov commented on GitHub (May 12, 2022):

The same problem, despite the fact that I forcibly open the first page

@seljmov commented on GitHub (May 12, 2022): The same problem, despite the fact that I forcibly open the first page
Author
Owner

@Cosmatevs commented on GitHub (May 5, 2023):

@enchev It's been fixed in 4.7.2

@Cosmatevs commented on GitHub (May 5, 2023): @enchev It's been fixed in [4.7.2](https://github.com/radzenhq/radzen-blazor/releases/tag/v4.7.2)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#406