Skip to content

Commit

Permalink
Merge pull request #22007 from magicjar/dev
Browse files Browse the repository at this point in the history
Fix Pagination Previous Button Behavior
  • Loading branch information
maliming authored Feb 1, 2025
2 parents 1bc20c3 + 36028ce commit 0a1c637
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ protected virtual async Task<string> GetPageAsync(TagHelperContext context, TagH
protected virtual async Task<string> GetPreviousButtonAsync(TagHelperContext context, TagHelperOutput output)
{
var localizationKey = "PagerPrevious";
var currentPage = TagHelper.Model.CurrentPage == 1
? TagHelper.Model.CurrentPage.ToString()
: (TagHelper.Model.CurrentPage - 1).ToString();
var currentPage = TagHelper.Model.CurrentPage > 1
? (TagHelper.Model.CurrentPage - 1).ToString()
: "1";
return
"<li class=\"page-item " + (TagHelper.Model.CurrentPage == 1 ? "disabled" : "") + "\">\r\n" +
"<li class=\"page-item " + (TagHelper.Model.CurrentPage <= 1 ? "disabled" : "") + "\">\r\n" +
(await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey)) + " </li>";
}

Expand Down

0 comments on commit 0a1c637

Please sign in to comment.