Browse Source

Ensure Previous Pagination Button is Disabled for Invalid Page

pull/22007/head
magicjar 2 years ago
parent
commit
36028cebcc
  1. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs

8
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs

@ -106,11 +106,11 @@ public class AbpPaginationTagHelperService : AbpTagHelperService<AbpPaginationTa
protected virtual async Task<string> GetPreviousButtonAsync(TagHelperContext context, TagHelperOutput output) protected virtual async Task<string> GetPreviousButtonAsync(TagHelperContext context, TagHelperOutput output)
{ {
var localizationKey = "PagerPrevious"; var localizationKey = "PagerPrevious";
var currentPage = TagHelper.Model.CurrentPage == 1 var currentPage = TagHelper.Model.CurrentPage > 1
? TagHelper.Model.CurrentPage.ToString() ? (TagHelper.Model.CurrentPage - 1).ToString()
: (TagHelper.Model.CurrentPage - 1).ToString(); : "1";
return 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>"; (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey)) + " </li>";
} }

Loading…
Cancel
Save