Browse Source

preserve filters while paginating (#405)

main
yigith 6 years ago
committed by GitHub
parent
commit
5c0f7fae29
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      src/Web/Pages/Shared/_pagination.cshtml

15
src/Web/Pages/Shared/_pagination.cshtml

@ -1,5 +1,14 @@
@model PaginationInfoViewModel
@{
var prevRouteData = Context.Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString());
if (prevRouteData.ContainsKey("pageId"))
prevRouteData.Remove("pageId");
prevRouteData.Add("pageId", (Model.ActualPage - 1).ToString());
var nextRouteData = Context.Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString());
if (nextRouteData.ContainsKey("pageId"))
nextRouteData.Remove("pageId");
nextRouteData.Add("pageId", (Model.ActualPage + 1).ToString());
}
<div class="esh-pager">
<div class="container-fluid">
<article class="esh-pager-wrapper row">
@ -7,7 +16,7 @@
<div class="col-md-2 col-xs-12">
<a class="esh-pager-item-left esh-pager-item--navigable esh-pager-item @Model.Previous"
id="Previous"
asp-route-pageid="@(Model.ActualPage - 1)"
asp-all-route-data="prevRouteData"
aria-label="Previous">
Previous
</a>
@ -22,7 +31,7 @@
<div class="col-md-2 col-xs-12">
<a class="esh-pager-item-right esh-pager-item--navigable esh-pager-item @Model.Next"
id="Next"
asp-route-pageid="@(Model.ActualPage + 1)"
asp-all-route-data="nextRouteData"
aria-label="Next">
Next
</a>

Loading…
Cancel
Save